开发者

Is it OK to edit the project paths in a Visual Studio solution (.sln) file without updating the GUIDs?

I have a solution that links to several library projects located elsewhere on my hard drive (outside my solution folder).

I would like to change things so that these project folders are now inside my solution folder.

So far, I have copied the project folders into my solution folder. Taking a look at the .sln file for my project, I noticed that there are a bunch of entries that looks like this:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FooBar", "..\..\..\Libraries\FooBar\FooBar.csproj", "{89FABBC5-4019-4887-AFE3-B005B0471486}"

I was thinking, Wouldn't it be nice and开发者_开发百科 easy if I could just get rid of ..\..\..\Libraries\ from all the relative paths?

However, these GUIDs are scaring me off. If I leave the GUIDs the same, will this cause problems?

Oh, and if you know a better way to do this, please let me know :)


Yeah sure - the GUID's are unique identifiers for the individual projects, but they are not linked to the project's path in any way, shape or form. Just an identifier that is used later on in the .sln file.

To be absolutely on the safe side :-), make a backup copy of your *.sln, then edit, and open the newly edited .sln in your Visual Studio.


For the most part, this seems to work, but I ran into problems with my Setup Project/Installer. When I re-opened my solution after editing the .sln file, my solution wouldn't build. I got the following error:

An error occurred while validating. HRESULT='80004005'

I tried completely deleting and rebuilding my Setup Project from scratch, but the error remained. The only thing that worked was to remove and re-add each project using the Solution Explorer in Visual Studio.

So the lesson is: Edit the .sln project file at your own risk. If you have a Setup Project, it very well might break.

Update

Here's a link further explaining the "HRRESULT" error: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=434666

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜