Static linking library to Unreal Engine 5

When I static link my library to UE5 project I get the error

Error C1900 Il mismatch between ‘P1’ version ‘20211117’ and ‘P2’ version ‘20210202’

The library was linked in build.cs file as:

     PublicAdditionalLibraries.Add("C:/Projects/RabbitMQ-AMQP-messenger/Project1/x64/Release/Project1.lib");

 and on top of my *.cpp file I included the apporiate header for the library. I build two times- UE from source and UE from binary files and no matter what the issue appeared.

This means that your visual studio installation is broken, or perhaps the build scripts for one of the libraries is incorrectly configured.

Googling for “Error C1900 visual studio” finds this link which has more information.

What do you mean by “script is incorrectly configured”?
I did a small library just for checking that it works. So I have a function
int AddNumbers(int, int) in it

The library is connected to other VS solutions with no problems, but in UE I got 1900 error. Currently, I am using Visual Studio 2022 and Unreal Engine 5.03.
How should I configure my *.lib file to make it work?