dotnet-template-samples icon indicating copy to clipboard operation
dotnet-template-samples copied to clipboard

Add an example of the state of the art on how to create a package from template dir

Open enricosada opened this issue 7 years ago • 1 comments

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>

enricosada avatar Jun 15 '17 09:06 enricosada

add with https://github.com/dotnet/templating/issues/954 the issue to add a donet new template

enricosada avatar Jun 15 '17 10:06 enricosada