Command 'dotnet publish' fails for projects publishing with GeneratePackageOnBuild=true.
TargetFramework is netcoreapp2.0.
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
This used to work with the previous SDK version 2.1.101.
The error it generates is:
"C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(168,5): error MSB3030: Could not copy the file "obj\Debug\netcoreapp2.0\
Do you have ay steps to reproduce? what project type is affected? I couldn't reproduce with a couple of configurations I thought you could have.
Sorry, apparently I haven't added enough details. Thank you for reacting so fast.
Project file should look like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
{
"sdk": {
"version": "2.1.300"
}
}
Fails with error
C:\Program C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(168,5): error MSB3030: Could not copy the file "obj\Debug\netstandard2.0\test1.dll" because it was not found. [C:\Users\
\Documents\Visual Studio 2017\Projects\test1\test1.csproj]
PS: modifying the global.json file to
{
"sdk": {
"version": "2.1.101"
}
}
and running dotnet publish succeeds
Thanks, can repro now. the important part to the repro is that no dotnet build etc. have been called before.
@nguerrera the problem here is that the new --no-build option for publish is interfering with the existing NuGet logic for GeneratePackageOnBuild which has logic to not trigger a build again while packing.
In essence, both pieces of logic use $(NoBuild) for this 馃槺
Is it still possible to rename publish's NoBuild to NoBuildOnPublish or something similar?
@gitorrin you are right, this is a regression in 2.1.3xx. The workaround is to explicitly build (dotnet build) before publishing.
Thanks for looking into this, @dasMulli.
Issue moved to dotnet/cli #9656 via ZenHub
Most helpful comment
@gitorrin you are right, this is a regression in 2.1.3xx. The workaround is to explicitly build (
dotnet build) before publishing.