A template for nuget packages projects
This is a template for creating .NET nugets projects. It includes a basic structure and some common files to get started quickly.
- Dotnet 9.0 or later
The TirsvadCLI.Template can be installed in several ways:
In github forks this project to your account and adjust it for your need.
-
Clone the repository:
git clone https://github.com/TirsvadCLI/Dotnet.Template.NugetPackage.git cd Dotnet.Template.NugetPackage
-
Restore dependencies:
dotnet restore
-
Update database (if needed):
dotnet ef database update --project src/Template.Infrastructure
-
Build the project:
dotnet build
-
Run the API:
dotnet run --project src/Template
dotnet add package NugetPackageName
Change TirsvadCLI/Dotnet.Template.NugetPackage with the name of your project. Change NugetPackageName with the name of your nuget package.
Add Doxygen to the project and add a script to generate the documentation.
In project file for library, add the following lines:
<PropertyGroup>
<VersionPrefix>0.1.0</VersionPrefix>
<PackageId>$(AssemblyName)</PackageId>
<Title></Title>
<Authors>Jens Tirsvad Nielsen</Authors>
<Company>TirsvadCLI</Company>
<PackageIcon>logo.png</PackageIcon>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<RepositoryUrl>https://github.com/TirsvadCLI/Dotnet.Template.NugetPackage</RepositoryUrl>
<PackageTags>Console</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<Description></Description>
</PropertyGroup>
<PropertyGroup>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\image\logo\64x64\logo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
run the command with parameters or change the top of the script file for your need
change these lines
param(
# Path to the project file; adjust this default value if needed.
[string]$ProjectFilePath = "$PSScriptRoot/src/Example/Example.csproj",
# Path to the NuGet API key for authentication.
[string]$NuGetApiKey = "$env:NugetTirsvadCLI", # Replace with your actual API key or set it in the environment variable.
# NuGet source URL (default is nuget.org).
[string]$NuGetSource = "https://api.nuget.org/v3/index.json",
# Path to the certificate file (PFX format) for signing
[string]$CertificatePath = "$PSScriptRoot/../../../cert/NugetCertTirsvad/Tirsvad.pfx",
# Password for the certificate file
[string]$CertificatePassword = "$env:CertTirsvadPassword", # Replace with your actual password or set it in the environment variable.
# Is this a NuGet package?
[switch]$IsNuGetPackage = $true,
# Selfsigned nuget should be off as Nuget.org donnot accept selfsigned packages
[switch]$SelfSignedNuGet = $true,
# Path to signtool.exe
[string]$SignToolPath = "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\signtool.exe"
)
and then run .\IncrementBuildAndPush.ps1
See example here
Dotnet.Template.NugetPackage/
βββ π docs/ # Documentation files
β βββ π doxygen/ # Doxygen output
βββ πΌοΈ images/ # Images used in documentation
βββ π src/ # Source code for the library
β βββ π¦ Template/ # Main project
β βββ π¦ Template.Application/ # Application layer
β β βββ π¦ Models/ # Data transfer objects (DTOs)
β β βββ π¦ Services/ # Application services
β βββ π¦ Template.Infrastructure/ # Infrastructure project
β β βββ π¦ Data/ # Data access layer
β β βββ π¦ Services/ # Infrastructure services
β βββ π¦ Template.Domain/ # Domain project
β βββ π¦Entities/ # Domain entities
βββ π tests/ # Test projects
βββ π¦ Template.Tests/ # Unit tests for the main project
βββ π¦ Template.IntegrationTests/ # Integration tests
Under folder src/** and tests/** is an example of how you can structure your project. This is just an example and you can change it as you like. Folders do not exist, but is just an example of how you can structure your project.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
See CONTRIBUTING.md
If you encounter a bug or have an issue to report, please follow these steps:
-
Go to the Issues Page
Navigate to the GitHub Issues page. -
Click "New Issue"
Click the green "New Issue" button to create a new issue. -
Provide Details
- Title: Write a concise and descriptive title for the issue.
- Description: Include the following details:
- Steps to reproduce the issue.
- Expected behavior.
- Actual behavior.
- Environment details (e.g., OS, .NET version, etc.).
- Attachments: Add screenshots, logs, or any other relevant files if applicable.
- Submit the Issue
Once all details are filled in, click "Submit new issue" to report it.
Distributed under the AGPL-3.0 License.
Jens Tirsvad Nielsen - LinkedIn