Sdk: `dotnet pack` does not include files from the tools folder

Created on 30 Aug 2017  路  3Comments  路  Source: dotnet/sdk

Steps to reproduce

  • Create a csproj with the following content:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
        <IsTool>true</IsTool>
  </PropertyGroup>
</Project>
  • Create a file named .\tools\Hello.ps1 with the content Write-Host hello.
  • Execute the following commands:
dotnet restore
dotnet build
dotnet pack
  • Check the generated nupkg

Expected behavior

The expected nupkg should contain:

  • The output assembly
  • The content of the tools folder.

Actual behavior

  • The nupkg only contains the output folder.

==> How can I include other files in the nuget package?

image

Environment data

.NET Command Line Tools (1.1.0)

Product Information:
 Version:            1.1.0
 Commit SHA-1 hash:  d6f4336106

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

Most helpful comment

I found the solution here and here.

Files from the tools folder can be added to the nupkg through this syntax:

    <Content Include="tools\**\*">
      <Pack>true</Pack>
      <PackagePath>tools\</PackagePath>
    </Content>

All 3 comments

I found the solution here and here.

Files from the tools folder can be added to the nupkg through this syntax:

    <Content Include="tools\**\*">
      <Pack>true</Pack>
      <PackagePath>tools\</PackagePath>
    </Content>

@mabead Where does this go? Its not allowed in the CSPROJ anylonger...

@JCanlett Sorry but our project has evolved in a way that this was not needed anymore. I there don't have an answer for you.

Was this page helpful?
0 / 5 - 0 ratings