It so happens quite often that I start by building some solution on the command line using msbuild, run it for awhile, but then discover that I need to change and debug it. So, I open it in Visual Studio and end up building it inside the Visual Studio.
What happens is that VS rebuilts quite a few parts of the solution, even when I change nothing!
Digging into it reveals the following:
Building inside Visual Studio generates empty cs files and injects them into the Compile
item group. Naturally, they are newer than the already built binaries and so devenv.exe rebuilds an awful lot of projects. Thanks to TemporaryGeneratedFile_[guid] in /obj/debug breaking build
This is a real bummer. I disabled this behavior by renaming the Microsoft.WorkflowBuildExtensions.targets
file - I do not do workflow.
I suppose I could hack into CoreCompileDependsOn
and somehow neutralize the GenerateCompiledExpressionsTempFile
target from Microsoft.WorkflowBuildExtensions.targets, but this has to be done in 190 projects! This is a serious change.
devenv.exe seems to care about some files always being copied to the output directory, even if msbuild does not think it is a problem.
Indeed, here is a line from the devenv.exe build log:
Project 'HRCore.Tests' is not up to date. Project item 'C:\abc\UI\HRCore.Tests\HRImport\Import_missing_state_county.xml' has 'Copy to Output Directory' attribute set to 'Copy always'.
So what? msbuild does not care about it, but devenv does. This files is not a dependency of the HRCore.Tests
and msbuild got it right.
In the meantime I changed it from Always
to PreserveNewest
.
Anyway, I am interested to know how can I eliminate these differences.
For example, is it a good idea to set BuildingInsideVisualStudio
to true
even when building with msbuild?
Any ideas?
P.S.
We build both .NET and Silverlight. Console applications, dlls and web applications.