Visual Studio Rebuilds projects when switching from debug to release and vice-versa when option XML documentation is selected

Visual Studio Rebuilds projects when switching from debug to release and vice-versa when option XML documentation is selected



I've a very similar problem than described in the following question
Visual Studio C# projects force a rebuild when switching from debug to release and vice-versa.



I've C# two projects and one has project reference to the other.
If I build (F6) in Debug and than I build (F6) in Release. If I now switch back to Debug and build (F6) it should be up to date.



That's is actually the case. So I can see that in the bin/Debug folder the file date and the assembly version are not changing.



But if I switch on the XML documentation file for the project which has project reference to the other under Project Properties / Build / Output for both configurations (Debug and Release) then the projects gets rebuild every time I switch from Debug to Release or vice-versa.



To recreate the issue:


File


New Project...


Visual C#


Console Application


Add


New Project...


Visual C#


Class Library


ConsoleApplication1


Add Reference...


ClassLibrary1


Solution


Projects


OK


XML documentation file


ConsoleApplication1


Properties


Build


Output


Debug


Release


Debug


Release


Debug



I'm getting the following build output:


1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Any CPU ------
1>Build started 07.09.2018 13:46:43.
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>CoreCompile:
1> C:Program Files (x86)MSBuild12.0binCsc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /platform:anycpu32bitpreferred /errorreport:prompt /warn:4 /doc:binDebugConsoleApplication1.XML /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva+ /reference:H:CSharpTestRebuildClassLibrary1binDebugClassLibrary1.dll /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5Microsoft.CSharp.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5mscorlib.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Core.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Data.DataSetExtensions.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Data.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Xml.dll" /reference:"C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5System.Xml.Linq.dll" /debug+ /debug:full /filealign:512 /optimize- /out:objDebugConsoleApplication1.exe /subsystemversion:6.00 /target:exe /utf8output Program.cs PropertiesAssemblyInfo.cs "C:UsersWOAppDataLocalTemp.NETFramework,Version=v4.5.AssemblyAttributes.cs" objDebug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs objDebug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs objDebug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
1>_CopyAppConfigFile:
1>Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
1>CopyFilesToOutputDirectory:
1> Copying file from "objDebugConsoleApplication1.exe" to "binDebugConsoleApplication1.exe".
1> ConsoleApplication1 -> H:CSharpTestRebuildConsoleApplication1binDebugConsoleApplication1.exe
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.41
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========



If XML documentation file is switched off I'm getting the following build output (it skips the CoreCompile as it should):


XML documentation file


1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Any CPU ------
1>Build started 07.09.2018 13:50:17.
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>CoreCompile:
1>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
1>_CopyAppConfigFile:
1>Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
1>CopyFilesToOutputDirectory:
1> ConsoleApplication1 -> H:CSharpTestRebuildConsoleApplication1binDebugConsoleApplication1.exe
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.07
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========



Is this a bug? Is there a workaround?




1 Answer
1



Visual Studio Rebuilds projects when switching from debug to release and vice-versa when option XML documentation is selected



Yes, this is a known issue for Visual Studio 2013 and Visual Studio 2015. It's just a faint shock that would not affect our build results except for the extra 0.00001 second execution time.



And this issue has been fixed in the Visual Studio 2017 version 15.6. I have test it on the latest version in Visual Studio 2017 15.8.2 (Current), it works as expected.



You can find the UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)" was added to the copy task in the target CopyFilesToOutputDirectory in the file Microsoft.Common.CurrentVersion.targets:


UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"


CopyFilesToOutputDirectory


Microsoft.Common.CurrentVersion.targets


<Copy
SourceFiles="@(IntermediateAssembly)"
DestinationFolder="$(OutDir)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
>

<Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>

</Copy>



If this bug affects your work, you can update your Visual Studio to the 2017.



Hope this helps.






I've tested it with Visual Studio 2017 15.7.6 and 15.8.2 and there are no unnecessary rebuild anymore.

– Wollmich
Sep 10 '18 at 6:13



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế