dotnet-publish --no-build produces assembly with versions different than build output
See original GitHub issueDuring migration from netcoreapp2.0 to netcoreapp2.1 I found that the behavior of dotnet publish --no-build behaves differently.
Steps to reproduce
Create ASP.NET core web app.
Website.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>0.0.0</Version>
<FileVersion>0.0.0.0</FileVersion>
<InformationalVersion>0000000000000000000000000000000000000000</InformationalVersion>
</PropertyGroup>
...
Run build from command line and override the versions
dotnet build -c Release /property:Version=1.2.3 /property:FileVersion=1.2.3.4 /property:InformationalVersion=abcdef12
This produces an assembly with the correct overridden version values.
Next run publish
dotnet publish -c Release --no-build
Expected behavior
The assembly that is output from running dotnet publish --no-build
has the same version numbers as the output from dotnet build
.
Actual behavior
A different assembly is produced, that contains the versions as specified in the csproj file. This is different than what occurred when targeting netcoreapp2.0, even when .NET Core SDK 2.1.300 is installed.
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json): Version: 2.1.300 Commit: adab45bf0c
Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support): Version: 2.1.0 Commit: caa7b7e2ba
.NET Core SDKs installed: 1.0.4 [C:\Program Files\dotnet\sdk] 2.1.4 [C:\Program Files\dotnet\sdk] 2.1.104 [C:\Program Files\dotnet\sdk] 2.1.201 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (16 by maintainers)
I’ll take a look at your repro shortly. Also, no need for apologies as we’re very grateful for your time to help improve .NET! 😄
https://github.com/dotnet/cli/issues/9656 for future cross-reference