[英]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:
看一下我项目的.sln文件,我注意到有很多条目看起来像这样:
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? 我当时在想,如果我能从所有相对路径中摆脱
..\\..\\..\\Libraries\\
会很好又容易吗?
However, these GUIDs are scaring me off. 但是,这些GUID吓坏了我。 If I leave the GUIDs the same, will this cause problems?
如果我保留GUID不变,这会引起问题吗?
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. 是的,可以肯定-GUID是各个项目的唯一标识符,但它们不会以任何方式,形状或形式链接到项目的路径。 Just an identifier that is used later on in the .sln file.
只是稍后在.sln文件中使用的标识符。
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. 为了绝对安全:-),请为您的* .sln创建一个备份副本, 然后进行编辑, 然后在Visual Studio中打开新编辑的.sln。
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.
当我在编辑.sln文件后重新打开解决方案时,我的解决方案将无法构建。 I got the following error:
我收到以下错误:
An error occurred while validating.
验证时发生错误。 HRESULT='80004005'
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.
唯一有效的方法是使用Visual Studio中的解决方案资源管理器删除并重新添加每个项目。
So the lesson is: Edit the .sln project file at your own risk. 因此,课程是:编辑.sln项目文件需要您自担风险。 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 以下是进一步解释“ HRRESULT”错误的链接: https ://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID = 434666
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.