question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add a `dotnet new template` for create a new ready to pack template

See original GitHub issue

Add a dotnet new template

So is ready to use with just dotnet restore and dotnet pack /p:Version=1.2.3

More options:

  • dotnet new template --type project (or --type item)
  • dotnet new template --sample option to add a sample conditional option

Is possibile to create package the template in lot of ways (nuget, nuspec, csproj, prj)

The best one i know atm is doing just with a .proj (any extension is ok), like https://github.com/fable-compiler/Fable/blob/master/src/templates/simple/Fable.Template.proj

so like Fable.Template.proj (note the .proj extension, neutral, not csproj, so doesnt mess with compiler targets)

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>

    <!-- fill some nuget package props (optional) -->
    <Description>Simple Fable App</Description>
    <Authors>Alfonso Garcia-Caro</Authors>
    <!-- fill nuget package version (optional) -->
    <Version>0.2.1</Version>

    <!-- this is a package -->
    <PackageType>Template</PackageType>

    <!-- cruft need to avoid building and making dotnet sdk happy -->
    <PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile>
    <NoBuild>true</NoBuild>
    <IncludeBuildOutput>false</IncludeBuildOutput>
    <TargetFramework>netstandard1.0</TargetFramework>
    <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>

  </PropertyGroup>
  <PropertyGroup>
    <!-- simple way to exclude things (optional but nice) -->
    <ExcludeFromPackage>
        Content/node_modules/**/*;
        Content/packages/**/*;
        Content/public/bundle.js*;
        Content/bin/**/*;
        Content/obj/**/*;
    </ExcludeFromPackage>
</PropertyGroup>
  <ItemGroup>
    <Content Include="Content/**/*" Exclude="$(ExcludeFromPackage)" >
        <PackagePath>Content\</PackagePath>
    </Content>
  </ItemGroup>
</Project>

ref https://github.com/dotnet/dotnet-template-samples/issues/14

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mlorbetskecommented, Jul 9, 2017
0reactions
tintoycommented, Jul 8, 2017

Cheers! Will get both sorted first thing tomorrow 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a template package for dotnet new - .NET
Learn how to create a csproj file that will build a template package for the dotnet new command.
Read more >
Create dotnet new template with multiple projects
Go to your root folder, open the powershell console. Create a nuget package dotnet pack .\nuget.csproj. Install the nuget package dotnet new -i ......
Read more >
Making a custom 'dotnet new' template - PatridgeDev
This is the first in a series of posts about creating custom templates for the dotnet new system. How to template. There are...
Read more >
How to Create Your .NET Project Template
This template allows developers to have a ready-to-run Auth0-enabled starter ... Then, add a new file named template.json to this newly created folder...
Read more >
How to build a .NET template and use it within Visual Studio ...
Like any NuGet package, you can upload the template pack to a NuGet feed. The dotnet new -i command supports installing the template...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found