dotnet / templating

This repo contains the Template Engine which is used by dotnet new
https://docs.microsoft.com/dotnet/
MIT License
1.61k stars 368 forks source link

Doc for creating a template pack duplicates the content in the nupkg #4140

Closed sayedihashimi closed 2 years ago

sayedihashimi commented 2 years ago

After following the steps at https://docs.microsoft.com/en-us/dotnet/core/tools/custom-templates#packing-a-template-into-a-nuget-package-nupkg-file my template nuget package has the content duplicated in the nuget package.

There is a content and and contentFiles folder in the .nupkg which has the same files. I played around with the csproj for a few min to see what is going on but didn't have time to fully investigate.

The code for my template is at https://github.com/sayedihashimi/sayedha.templates.

I also found the following nuget packages which I believe suffer from the same issue.

Can we get the doc updated so that it doesn't duplicate the content in the generated nupkg file? After we should reach out to these template authors to fix their nuget packages as well.

vlada-shubina commented 2 years ago

@sayedihashimi I checked your package - in your case the following property was missing: <ContentTargetFolders>content</ContentTargetFolders>

I will check other packages - likely the same issue.

It's present in the doc, so nothing to fix there.

vlada-shubina commented 2 years ago

SpecFlow.Templates.DotNet has a different issue causing the content to appear twice, other templates have the same issue with having no <ContentTargetFolders>content</ContentTargetFolders> defined.

Inform those authors on how to fix their templates.

sayedihashimi commented 2 years ago

Thanks @vlada-shubina, not sure how I missed that. I have added an issue to track adding validation to ensure duplicate content isn't in a template .nupkg https://github.com/sayedihashimi/template-sample/issues/48.