New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet pack with nuspec file does not set PackageVersion from csproj #6636

Open
livarcocc opened this Issue Mar 2, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@livarcocc

livarcocc commented Mar 2, 2018

From @maciejjarzynski on March 2, 2018 9:49

Steps to reproduce

When running dotnet pack on the project which also has .nuspec file specified, and the version is being set only in .csproj PackageVersion setting, while in nuspec it is a variable $version$, it fails to create package.

Csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Version>1.1.1</Version>
    <PackageVersion>1.1.1</PackageVersion>
    <NuspecFile>TestAssembly.nuspec</NuspecFile>
    <TargetFramework>netstandard2.0</TargetFramework>    
  </PropertyGroup>
</Project>

Nuspec:

<?xml version="1.0"?>
<package >
  <metadata>
    <id>TestAssembly</id>
    <version>$version$</version>
    <authors>Test</authors>
    <description>Description</description>
  </metadata>
</package>

Command to run:
dotnet pack

Expected behavior

Creating package with version provided in .csproj file.

Actual behavior

An error during dotnet pack:

C:\Program Files\dotnet\sdk\2.1.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): error : Value cannot be null or an empty string. [...\TestAssembly.csproj]
C:\Program Files\dotnet\sdk\2.1.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): error : Parameter name: value [...\TestAssembly.csproj]

Environment data

dotnet --info output:
.NET Command Line Tools (2.1.4)

Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190

Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.4\

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Copied from original issue: dotnet/cli#8717

@livarcocc

This comment has been minimized.

livarcocc commented Mar 2, 2018

@rohit21agrawal If this is something that the SDK should be setting but it is not, then please, comment and re-activate the original issue.

@KevReed

This comment has been minimized.

KevReed commented May 2, 2018

Adding <NuspecProperties>version=$(Version)</NuspecProperties> to the csproj seems to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment