对我的项目进行一些更改后,Visual Studio开始重新编译所有源代码,导致所有依赖项目也重新编译,从而大大降低了开发速度。那是为什么?
XML documentation file
且有Copy always
的文件时才会发生。如果您更改其中任何一个,则不会重新编译源代码。MSBuild
进行编译时,源代码不会被重新编译。答案 0 :(得分:1)
当项目XML documentation file
使用Copy always
检查了某些文件时,这似乎是Visual Studio中的错误。
<强>摄制:强>
XML documentation file
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,您会看到devenv.exe在MSBuild.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