Open Porges opened 6 years ago
There's another problem in that the project.assets.json
is being put in the root of the shared intermediate output folder (obj
)... which obviously causes issues when all projects are sharing it 🙂
Error message is like:
1>C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5): error : Assets file '...\obj\project.assets.json' doesn't have a target for '.NETStandard,Version=v2.0'. Ensure that restore has run and that you have included 'netstandard2.0' in the TargetFrameworks for your project.
Thanks for reporting this. The CBT.UnifiedOutputDir
appears to have a conflict with the fundamental concept of what BaseIntermediateOutputPath
is. In NuGet 3.0, they took over BaseIntermediateOutputPath
and treated it as a unique-per-project but platform and configuration agnostic folder. However, CBT.UnifiedOutputDir
treats BaseIntermediateOutputPath
as a repository-wide folder where projects then add on to it.
So the root of the issue is that the project.assets.json
file for all projects in the tree are written to the same location. This means that during build, projects are using another project's assets file which is wrong and the build fails.
So we'll need to rework the package if we ever want it to work with PackageReference
and NuGet v3+
I ended up just doing the following in Directory.Build.props
:
<PropertyGroup>
<OutputPath>$(EnlistmentRoot)\bin\$(Configuration)\$(Platform)\$(MSBuildProjectName)</OutputPath>
<OutDir>$(OutputPath)\$(TargetFramework)</OutDir>
</PropertyGroup>
Not sure how correct that is but it produces the desired results for me.
Sharing intermediate output directories is not something I need to have a unified output directory 🙂
I took the sample (internal) project "Template-VS2017-CloudBuild" which worked fine, and added
CBT.UnifiedOutputDir
(2.0.16) to it. This causes the following error to happen:I also created a new .NET Core project which was not affected by this problem.