question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet-publish --no-build produces assembly with versions different than build output

See original GitHub issue

During 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:closed
  • Created 5 years ago
  • Comments:21 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
peterhuenecommented, Jul 18, 2018

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! 😄

0reactions
nguerreracommented, Feb 14, 2019

I realise now that we’ve had this conversation before but I only remembered half of it

https://github.com/dotnet/cli/issues/9656 for future cross-reference

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet publish command - .NET CLI
dotnet publish - Publishes the application and its dependencies to a folder for deployment to a hosting system.
Read more >
Why does dotnet publish not publish the versions expected?
I see no reference to v4.0.0.1 in the build output, aside from this: Unified primary reference "System.IO.Pipelines, Version=4.0.0.1 ...
Read more >
.NET Core SDK Projects: Controlling Output Folders and ...
Since I'm creating an Addin that runs in the context of the host project, there's no need to duplicate the dependencies in the...
Read more >
Updating the version number in your .NET build pipeline
As part of our build process, I needed to version the assembly with the latest build number. This is the first step in...
Read more >
error NETSDK1194: The "--output" option isn't supported ...
The --output option is disallowed because all outputs of all built projects would be copied into the specified directory, which isn't compatible ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found