Search code examples
gitignorevisual-studio-templates

Leading-dot files missing from custom Visual Studio template


I've created a custom Visual Studio template containing an ASP.NET Core+angular application. But when I create a new project using this template, the files starting with . are missing from the generated project.

These are the files in the ClientApp folder of the template project:

The template project folder contains files with a leading dot

But when I package the template project, install them using

dotnet new --install MintPlayer.AspNetCore.IdentityServer.Templates

These files are missing from the generated project:

The generated project doesn't contain the files starting with a dot

I've already taken a look at the following, but without success:

When I run

dotnet pack --configuration Release

I can see the following printed in the console:

C:\...\NuGet.Build.Tasks.Pack.targets(221,5):
warning NU5119: File 'C:\repos\Example.AspNetCore.Templates\Example.AspNetCore.Templates\Templates\Application\Web\ClientApp\node_modules\resolve\.editorconfig' was not added to the package. Files and folders starting with '.' or ending with '.nupkg' are excluded by default. To include this file, use -NoDefaultExcludes from the commandline [C:\...\Example.AspNetCore.Templates.csproj]

How can I include these files anyway in my package as "Content"?

References:


Solution

  • Adding

    <NoDefaultExcludes>true</NoDefaultExcludes>
    

    To the root csproj file solved the issue

    The spa-templates repository does the same