Packing and installing the template - NeoSOFT-Technologies/rest-dot-net-core GitHub Wiki
To install and use the template we first need to pack it in the NuGet package. For this, a .nuspec file should be created outside the root folder which is an XML file containing package-related information.
- id: Should be unique
- version: Should be incremented every time template is changed. Minor-Major versions pattern must be followed.
- files: Files to be excluded from the resulting solution created by using the template
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Neosoft.Technologies.Templates</id>
<version>2.0.3</version>
<description>
Template for creating an ASP.NET Core Solution with Clean Architecture
</description>
<authors>Neosoft Technologies</authors>
<license type="expression">MIT</license>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
<files>
<file src="Content\**\*.*" exclude="Content\**\bin\**\*.*;Content\**\obj\**\*.*;Content\.vs\**" target="Content" />
</files>
</package>
- Download nuget.exe for windows from here
- Move nuget.exe to C:\Users\user\AppData\Local\NuGet directory
- Add path C:\Users\user\AppData\Local\NuGet to the system environment variables
Following command will create .nupkg file in C:\Packages\NuGet folder
nuget pack Neosoft.Technologies.Templates.nuspec -OutputDirectory C:\Packages\NuGet
- Add local folder to NuGet sources to install local NuGet packages
nuget source add -Name LocalPackages -Source C:\Packages\NuGet
- Install local package
dotnet new --install Neosoft.Technologies.Templates.2.0.3.nupkg
Follow instructions from here to create the solution using the installed template