@gitorrin commented on Thu Jul 12 2018
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\
@dasMulli commented on Thu Jul 12 2018
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.
@gitorrin commented on Thu Jul 12 2018
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
@dasMulli commented on Thu Jul 12 2018
Thanks, can repro now. the important part to the repro is that no dotnet build etc. have been called before.
@dasMulli commented on Thu Jul 12 2018
@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?
@dasMulli commented on Thu Jul 12 2018
@gitorrin you are right, this is a regression in 2.1.3xx. The workaround is to explicitly build (dotnet build) before publishing.
@gitorrin commented on Thu Jul 12 2018
Thanks for looking into this, @dasMulli.
Adding @wli3 who fixed some other issues with pack and nobuild.
Is it still possible to rename publish's NoBuild to NoBuildOnPublish or something similar?
This would be technically breaking if using msbuild and /p directly. Let's see if there's another fix first.
@wli3 Can you take first look at this?
Oh, and thanks @gitorrin for the report and @dasMulli for the investigation.
@nguerrera can you explain why this was moved to closed? We are seeing the problem in dotnet v2.1.500 downloaded today. Is it meant to be fixed already?
@jjpepper it's not closed ;)
yeah, when it will be fixed? I have the same problem with GenerateDocumentationFile
@Marusyk Did you mean GeneratePackageOnBuild rather that GenerateDocumentationFile. I cannot see how this issue would relate to the latter. If you have something that does, please open a new issue with complete steps to reproduce the problem.
Just adding that I'm suffering the same issue. Adding GeneratePackageOnBuild true fails with Could not copy the file [...].dll because it was not found
duplicated of https://github.com/dotnet/sdk/issues/3367
fixed by https://github.com/dotnet/sdk/pull/3473