这似乎是在Visual Studio中的一个bug,当项目有XML documentation file
查了一些文件与Copy always
。
摄制:
- 创建新项目 - C#类库。
- 项目属性=>生成=>检查
XML documentation file
- 项目=>添加=>新项目=>文本文件
TextFile1.txt
- 变化TextFile1.txt
Copy to Output Directory
到Copy always
- 右击项目=>打造
- 右击项目=>建立
预计:项目不应该建,建输出应该说:
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
实际:项目是建,输出是:
------ Build started: Project: ClassLibrary1, Configuration: Debug Any CPU ------
ClassLibrary1 -> bin\Debug\ClassLibrary1.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Intestigation:车削在详细日志中,您会看到:
Target "CoreCompile" in file "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets" from project "ClassLibrary1.csproj" (target "Compile" depends on it):
Building target "CoreCompile" completely.
Output file "bin\Debug\ClassLibrary1.XML" does not exist.
寻找procmon,你会发现在MSBuild.exe运行之前,devenv.exe将“ClassLibrary1.XML”重命名为“vsA381.tmp”。重命名堆栈跟踪:
KERNEL32!MoveFileW+0x17
csproj!CMoveOutOfTheWayScope::EnterScope+0x85
csproj!CVsProjBuildableProjectCfg::StartBuildProcessWithTarget+0x50b
csproj!CVsProjBuildableProjectCfg::StartBuildProcess+0xc
csproj!CVsProjBuildableProjectCfg::StartBuildEx+0x15
msenv!CSUIBuilder::DoBuild+0x1a3
msenv!CSUIBuilder::Run+0x66
我使用VS 2013更新2,我看到相同的不想要的行为:当源代码没有发生任何更改时重新编译项目。即使我没有在我的解决方案的任何项目中选中“XML文档文件”,也会发生这种情况。所以还有其他原因。 :-( – farfareast
好吧,你可以在下面我的回答中对它进行调查,并报告你的发现。 – Jonathan