Skip to content

TirsvadCLI/Dotnet.Template.NugetPackage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

NuGet DownloadsContributorsForksStargazersIssuesLicenseLinkedIn

Logo Dotnet.Template.NugetPackage.NugetPackage

A template for nuget packages projects

Description

This is a template for creating .NET nugets projects. It includes a basic structure and some common files to get started quickly.

Features

Getting Started

Prerequisites

  • Dotnet 9.0 or later

Installation

The TirsvadCLI.Template can be installed in several ways:

Fork the projects

In github forks this project to your account and adjust it for your need.

Clone the repo (In the project have something simerly to this)

Repo size

  1. Clone the repository:

    git clone https://github.com/TirsvadCLI/Dotnet.Template.NugetPackage.git 
    cd Dotnet.Template.NugetPackage
  2. Restore dependencies:

    dotnet restore
  3. Update database (if needed):

    dotnet ef database update --project src/Template.Infrastructure
  4. Build the project:

    dotnet build
  5. Run the API:

    dotnet run --project src/Template

NuGet Package

dotnet add package NugetPackageName

Usage

Notes

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>

Increment version number script file

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

Example of code

See example here

πŸ“‚ Folder Structure

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.

Contributing

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

Bug / Issue Reporting

If you encounter a bug or have an issue to report, please follow these steps:

  1. Go to the Issues Page
    Navigate to the GitHub Issues page.

  2. Click "New Issue"
    Click the green "New Issue" button to create a new issue.

  3. 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.
  1. Submit the Issue
    Once all details are filled in, click "Submit new issue" to report it.

License

Distributed under the AGPL-3.0 License.

Contact

Jens Tirsvad Nielsen - LinkedIn

Acknowledgments

About

A template for nuget packages projects

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published