Skip to content
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

NuGet pack doesn't include inner nuspec files with package type Template #6862

Open
Mackiovello opened this issue Apr 25, 2018 · 2 comments
Open
Labels
Functionality:Pack Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:DCR Design Change Request
Milestone

Comments

@Mackiovello
Copy link

Details about Problem

Product: NuGet CLI
NuGet version 4.4.1.4656
.NET Command Line Tools (2.1.4)
Windows 10

To reproduce

Run nuget pack in the StarDefaultPackage directory of the attached project at the bottom of this issue.

Expected

All the files in the content directory are copied.

Actual

All the files except for the inner nuspec file in StarDefaultPackage\content\src\StarDefault are included.

Use case

I want to create a custom template for dotnet new that I can distribute as a NuGet package. The template has a nuspec file that I want to include.

Other suggested things

Verbose Logs

nuget pack -verbosity detailed
NuGet Version: 4.4.1.4656
Attempting to build package from 'StarDefaultPackage.nuspec'.

Id: Starcounter.LibraryPackage.Default
Version: 0.0.1
Authors: Erlend Landrö
Description: Creates a solution with a class library and tests. It's set up for packaging and distributing via NuGet.
Dependencies: None

Added file '[Content_Types].xml'.
Added file '_rels/.rels'.
Added file 'content/%STAR_NUGET%/README.md'.
Added file 'content/.template.config/template.json'.
Added file 'content/build/build.cake'.
Added file 'content/build/packages.config'.
Added file 'content/build/StarDefault.cake'.
Added file 'content/nuget.config'.
Added file 'content/README.md'.
Added file 'content/src/StarDefault/Class1.cs'.
Added file 'content/src/StarDefault/StarDefault.csproj'.
Added file 'content/StarDefault.sln'.
Added file 'content/test/StarDefault.Tests/StarDefaultPackage.Tests.csproj'.
Added file 'content/test/StarDefault.Tests/UnitTest1.cs'.
Added file 'package/services/metadata/core-properties/82b3c993650d4ac1992c97c103dbfa7a.psmdcp'.
Added file 'Starcounter.LibraryPackage.Default.nuspec'.

Successfully created package 'C:\Starcounter\Starcounter.DotnetTemplates\StarDefaultPackage\Starcounter.LibraryPackage.Default.0.0.1.nupkg'.

Notice how the nuspec file that should be next to content/src/StarDefault/StarDefault.csproj is not included.

Sample Project

Starcounter.DotnetTemplates.zip

@rohit21agrawal
Copy link
Contributor

this is currently not supported. We will take this feedback and add it to our backlog.

Unfortunately, there is no workaround for this either.

@mc0re
Copy link

mc0re commented May 4, 2021

Three years have passed, still no solution? :-(
I used the following workaround.

Part 1. Rename the .nuspec file to .nuspec.RENAME_ME. The file is successfully added to the package.

Part 2. Create a batch file 6862.bat:

rename TemplateApp\\TemplateApp.nuspec.RENAME_ME TemplateApp.nuspec
del 6862.bat

Part 3. Create a "rename" action in template.json.

  "postActions": [
    {
      "actionId": "3A7C4B45-1F5D-4A30-959A-51B88E82B5D2",
      "description ": "Rename 'nuspec' file, see https://github.com/NuGet/Home/issues/6862",
      "args": {
        "executable": "6862.bat",
        "args": ""
      },
      "manualInstructions": [
        { "text": "Rename '*.nuspec.RENAME_ME' to '*.nuspec'." }
      ],
      "continueOnError": true
    },
    ...

Note the self-deleting statement in the bat file as well as continueOnError flag in the action. This is to only have 1 action instead of two, and to not check in the batch file into the source control.

jan-bures added a commit to SpaceWarpDev/SpaceWarp.Template that referenced this issue Oct 30, 2023
@jeffkl jeffkl added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. and removed Pipeline:Icebox labels Apr 3, 2024
@nkolev92 nkolev92 added Type:DCR Design Change Request and removed Type:Bug labels Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:DCR Design Change Request
Projects
None yet
Development

No branches or pull requests

6 participants