我有一个VS2010的工作安装,直到大约一年前我在这台机器上大量使用,并且在过去一年中只使用了很少。它曾经很好地构建了我的所有项目,但在几个月前使用它之后,我打开它,尝试构建一个解决方案,并且它无法构建,因为它似乎在准随机位置创建输出文件硬盘。
要解决这个问题,我只是创建了一个全新的WinForms项目,并且在不更改模板中的单行代码的情况下,我构建了它。当VS愉快地宣布它的构建时,我看到同样的问题似乎困扰着我的真正解决方案(实际上它包含了大约160个项目(C#,一些C ++)的4-5个解决方案:一个名为“target”的目录“与.sln文件在同一文件夹中创建。在该文件夹中是另一个名称与解决方案相同的文件夹,其中包含bin文件夹(还有内部是Debug和Release)文件夹。
这是文件夹结构
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall.sln
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Release
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug\Test VS after reinstall.exe
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug\Test VS after reinstall.pdb
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\bin
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Form1.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Form1.Designer.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Program.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Test VS after reinstall.csproj
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\bin\Debug
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\bin\Debug\Test VS after reinstall.vshost.exe
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\GenerateResource.read.1.tlog
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\GenerateResource.write.1.tlog
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\TempPE
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\Test VS after reinstall.csproj.FileListAbsolute.txt
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\Test VS after reinstall.exe
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\Test VS after reinstall.pdb
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\obj\x86\Debug\Test_damn_VS_after_reinstall.Properties.Resources.resources
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties\AssemblyInfo.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties\Resources.Designer.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties\Resources.resx
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties\Settings.Designer.cs
C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\Properties\Settings.settings
你可以看到第1和第3到第8行似乎不正确。
在我的真正解决方案上,它产生了巨大的差异,因为所有解决方案和项目都配置为构建到一个公共文件夹,并且都由相对路径(构建属性中的输出目标)配置。随着所有引用现在搞砸了,各种项目都会在硬盘的各个部分结束,当然没有什么可以正常构建。
我在Win7SP1 x64,VS2010 Ultimate SP1上运行。
另外值得一提的是,使用预构建步骤并回显一些宏(可扩展的构建变量),我可以看到宏没有解析到正确的文件夹。有趣的是,Visual Studio展示了它的一件事(项目属性,构建事件,预构建,编辑预构建,宏按钮)。它显示以下内容:
Outdir: bin\Debug
TargetPath: C:\Users\{user}\Documents\Visual Studio 2010\Projects\Test VS after reinstall\Test VS after reinstall\bin\Debug\Test VS after reinstall.exe
但是,当构建实际运行并且预构建步骤定义为:
echo OutDir: $(OutDir)
echo TargetPath: $(TargetPath)
输出结果为:
------ Build started: Project: Test VS after reinstall, Configuration: Debug x86 ------
OutDir: C:\Users\{user}\documents\visual studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug\
TargetPath: C:\Users\{user}\documents\visual studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug\Test VS after reinstall.exe
Test VS after reinstall -> C:\Users\{user}\documents\visual studio 2010\Projects\Test VS after reinstall\target\Test VS after reinstall\bin\Debug\Test VS after reinstall.exe
有关Visual Studio正在发生什么的想法吗?
答案 0 :(得分:1)
在MSDN论坛的MS人员的帮助下,最终发现了这一切。
http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/d6a626c0-f43a-4a70-ba4e-0f377fc11b17