-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution Rebuild might fail when a shared output directory is used #19534
Comments
Related issue: #17645 |
#17645 tracks the issues related to building to a common output folder. This is not recommended though as it's safer to compile and then copy after. We do not have plans at the moment to improve this experience beyond the @tdykstra to investigate whether we should have a document covering |
@ghogen should we add |
@tdykstra Yes, thanks. Created issue as linked above. |
I just would like to add some info why a shared output directory is useful and might be kind of needed for some solutions. On the one hand project-scoped output directories do not really scale well with large solutions because each executable project will copy all of its (transitive) NuGet DLLs into its output directory, same goes for test projects. (For our solution this ended up in several GB of duplicated DLLs in those directories which is especially problematic for the potentially limited space on build agents.) And on the other hand it is far more closer to how it usually would end up on the customer's PCs where all binaries will be installed into one directory, e.g. like MS Office. (At least I would have no good idea how to finally copy all resulting files of all top level, executable projects into a final common directory while maintaining the default output locations for each project.) Any recommendations would be pretty welcome, if there are any. |
@MichaeIDietrich, Microsoft.Build.Artifacts looks like it could be used to "finally copy all resulting files". That would consume even more disk space, though. |
Regardless of whether UseCommonOutputDirectory is documented or not, I still believe it should be possible to easily build several projects to one output directory. This will most likely cause issues if people (like ourselves) are starting to migrate some older projects to SDK format - that is what seemingly broke our builds |
If it helps, I posted a possible solution here which allows you to not set |
[main] Update dependencies from dotnet/sdk - Coherency Updates: - Microsoft.WindowsDesktop.App.Ref: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.WindowsDesktop.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.WindowsDesktop.TargetingPack.x64.9.0: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.NetCore.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Ref: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.NetCore.TargetingPack.x64.9.0: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Host.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.Platforms: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.runtime.linux-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Ref: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Ref.Internal: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.AspNetCore.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-dev-certs: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-user-jwts: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-user-secrets: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.aspnetcore: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.WindowsDesktop.App.Runtime.win-x64: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - Microsoft.WindowsDesktop.App.Runtime.win-x64: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - Microsoft.DotNet.Wpf.ProjectTemplates: from 9.0.0-preview.4.24218.2 to 9.0.0-preview.4.24219.1 (parent: Microsoft.WindowsDesktop.App.Runtime.win-x64) - Microsoft.FSharp.Compiler: from 12.8.400-beta.24218.1 to 12.8.400-beta.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.fsharp: from 8.0.400-beta.24218.1 to 8.0.400-beta.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.Net.Compilers.Toolset: from 4.11.0-1.24218.2 to 4.11.0-1.24222.7 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.roslyn: from 4.11.0-1.24218.2 to 4.11.0-1.24222.7 (parent: Microsoft.NET.Sdk) - Microsoft.Build: from 17.11.0-preview-24218-01 to 17.11.0-preview-24222-11 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.msbuild: from 17.11.0-preview-24218-01 to 17.11.0-preview-24222-11 (parent: Microsoft.NET.Sdk) - NuGet.Build.Tasks: from 6.11.0-preview.1.27 to 6.11.0-preview.1.28 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Install node 20.x on windows build to fix aspnetcore build - Merge branch 'main' into darc-main-35a979bc-455b-4e15-b1bf-6da27d06b3a5 - Rebootstrap VMR with arcade changes - Merge branch 'main' into darc-main-35a979bc-455b-4e15-b1bf-6da27d06b3a5 - Remove patches
[main] Update dependencies from dotnet/sdk - Coherency Updates: - Microsoft.WindowsDesktop.App.Ref: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.WindowsDesktop.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.WindowsDesktop.TargetingPack.x64.9.0: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.NetCore.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Ref: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.NetCore.TargetingPack.x64.9.0: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Host.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.Platforms: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.runtime.linux-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Ref: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Ref.Internal: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.AspNetCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - VS.Redist.Common.AspNetCore.SharedFramework.x64.9.0: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-dev-certs: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-user-jwts: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - dotnet-user-secrets: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.aspnetcore: from 9.0.0-preview.4.24218.1 to 9.0.0-preview.4.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.WindowsDesktop.App.Runtime.win-x64: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - Microsoft.WindowsDesktop.App.Runtime.win-x64: from 9.0.0-preview.4.24218.3 to 9.0.0-preview.4.24220.1 (parent: Microsoft.NET.Sdk) - Microsoft.DotNet.Wpf.ProjectTemplates: from 9.0.0-preview.4.24218.2 to 9.0.0-preview.4.24219.1 (parent: Microsoft.WindowsDesktop.App.Runtime.win-x64) - Microsoft.FSharp.Compiler: from 12.8.400-beta.24218.1 to 12.8.400-beta.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.fsharp: from 8.0.400-beta.24218.1 to 8.0.400-beta.24223.1 (parent: Microsoft.NET.Sdk) - Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.Net.Compilers.Toolset: from 4.11.0-1.24218.2 to 4.11.0-1.24222.7 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.roslyn: from 4.11.0-1.24218.2 to 4.11.0-1.24222.7 (parent: Microsoft.NET.Sdk) - Microsoft.Build: from 17.11.0-preview-24218-01 to 17.11.0-preview-24222-11 (parent: Microsoft.NET.Sdk) - Microsoft.SourceBuild.Intermediate.msbuild: from 17.11.0-preview-24218-01 to 17.11.0-preview-24222-11 (parent: Microsoft.NET.Sdk) - NuGet.Build.Tasks: from 6.11.0-preview.1.27 to 6.11.0-preview.1.28 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Microsoft.NETCore.App.Runtime.win-x64: from 9.0.0-preview.4.24218.7 to 9.0.0-preview.4.24222.8 (parent: Microsoft.NET.Sdk) - Install node 20.x on windows build to fix aspnetcore build - Merge branch 'main' into darc-main-35a979bc-455b-4e15-b1bf-6da27d06b3a5 - Rebootstrap VMR with arcade changes - Merge branch 'main' into darc-main-35a979bc-455b-4e15-b1bf-6da27d06b3a5 - Remove patches
Steps to Reproduce
Actual Behavior
Compilation fails:
Expected Behavior
Both projects compile successfully.
Analyzation
The
Clean
target of the test project will also clear the*.deps.json
of the referenced project,which then leads to the issue that the test project can no longer copy the
*.deps.json
file when theCopyFilesToOutputDirectory
target is invoked to copy transtively referenced items.There is a
FileWritesShareable
item group that is used to filter out shared items so theClean
target does not delete shared files. But for some reason it does not work for*.runtimeconfig.dev.json
,*.runtimeconfig.json
and*.deps.json
.Workaround
Setting
UseCommonOutputDirectory
totrue
will prevent any copying and cleaning of transitively referenced items and might be the recommended solution here.Edit:
As it turns out the workaround does not work as expected, since it also prevents any referenced item to be copied.
Unfortunately there is a condition on the
Copy
task within the_CopyFilesMarkedCopyLocal
target.Question
While there is a workaround, I still think that not usingUseCommonOutputDirectory
should compile nevertheless.There is no information
UseCommonOutputDirectory
. Maybe this property should be officially documented somewhere?The text was updated successfully, but these errors were encountered: