Adding an existing project to the solution edits the project file

I have a C ++ solution ( solution.sln ) where I want to add an existing library ( library.vcproj ), so I open solution.sln in Visual Studio and include the library.vcproj file in it. Then I install the project dependencies, and some include paths so that they can be compiled. Everything is working fine.

When I am about to commit these changes to the repository (svn), I noticed that library.vcproj has changed. I am checking the differences and this is only the GUID for the project that has changed. I look at the differences in solution.sln and find out that, as I expected, the new project GUID is used to identify library.vcproj .

I have done this gazillion times and I have never seen this behavior before.

As a workaround, to avoid modifying the library.vcproj file, I revert its changes and manually edit solution.sln , replacing the new project GUID for the old one.

When opening solution.sln in Visual Studio, everything works fine, but a new GUID is created, replacing the libray project in both solution.sln and library.vcproj .

library.vcproj included in several other solutions, so just committing the change will affect several other files.

What could be causing this behavior? Is the GUID or project link stored elsewhere?

I am using Visual Studio 2005 .

+4
source share
1 answer

I found the reason for this behavior. This is not a VS error, this is really reliable behavior!

There is another library in solution.sln with the same GUID, so VS updates the GUID of the incoming library.vcproj .

Digging in svn logs, I could find that someone had copied the library.vcproj file from the anther library and edited only the library name. Both libraries share most of the assembly configuration data and other materials in the .vcproj file, but forget to change the GUID value.

I am ashamed of this, but ... that someone turned out to be me.

Thanks for your comments and time to consider this.

+4
source

Source: https://habr.com/ru/post/1337170/


All Articles