Skip to content

License file with no extension fails to pack with dotnet pack and msbuild /t:pack #7601

@agr

Description

@agr

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): dotnet.exe and msbuild.exe

dotnet.exe --version (if appropriate): 2.1.600-preview-009426
msbuild version: 16.0.218-preview+g5c625fa747

Detailed repro steps so we can see the same problem

  • dotnet new classlib
  • edit generated csproj, add the following lines:
  <PropertyGroup>
    <PackageLicenseFile>license</PackageLicenseFile>
  </PropertyGroup>

  <ItemGroup>
    <None Include="license" Pack="true" PackagePath="$(PackageLicenseFile)" />
  </ItemGroup>
  • Create the license file with any text
  • dotnet pack

Verbose Logs

> dotnet pack
Microsoft (R) Build Engine version 16.0.225-preview+g5ebeba52a1 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 39.19 ms for E:\dev\misc\libtest3\libtest3.csproj.
C:\Program Files\dotnet\sdk\2.1.600-preview-009426\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(143,5): message NETSDK1057: You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 [E:\dev\misc\libtest3\libtest3.csproj]
  libtest3 -> E:\dev\misc\libtest3\bin\Debug\netstandard2.0\libtest3.dll
C:\Program Files\dotnet\sdk\2.1.600-preview-009426\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(199,5): error NU5030: The license file 'license' does not exist in the package. [E:\dev\misc\libtest3\libtest3.csproj]

Other

If I remove the <PackageLicenseFile>license</PackageLicenseFile> line, it packs fine and license file is added to nupkg. It also works if I drop the PackagePath="$(PackageLicenseFile)" portion. And it works if I use license.txt as a file name everywhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions