| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is a nuget/paket main scaffold component to create others packages
Build and run tests
.NET official package manager to generate .nupkg file
Integrated with Nuget to manage dependencies, with more clear files and allow use Git dependencies
Use Chocolatey
choco install dotnetcore-sdkOr download from https://dotnet.microsoft.com/download
Restart your terminal and check if the cli dotnet is in your $PATH environment variable
Use Chocolatey
choco install nuget.commandlineOptionally, you can install with Chocolatey too
# Install nuget AUTH PROVIDER
# to push package for feed authenticate
choco install nuget-credentialprovider-vssThis is required to push .nupkg packages to Azure Artifacts
Use .NET Core tools to install paket command line locally
dotnet tool install -g paketIf you got any error using paket with .NET Core, try install using chocolatey
choco install paketPS: Install globally if you will use paket in others projects. You can use globally also if your project not use .NET Core.
Use Chocolatey
# Install base Azure CLI (command line)
choco install azure-cli
# Install Azure Devops extensions
az extension add --name azure-devopspaket restore
dotnet restore# Build the solution
dotnet build
# Run all tests
dotnet testYour project folders structure should be:
The .NET solution group projects
The project with Unit and/or Integration tests
The project with your library/component core
Make sure that project builds and all tests are passed
# Build the solution
dotnet build
# Run all tests
dotnet testGenerate the .nupkg file
# Pack your component to the path nupkg/*.nupkg
dotnet pack --include-symbols --configuration Release --output .\nupkg [your-component-project]PS: If you not pass the --outputs flag, the .nupkg file is generated in: [your-component-project]/bin/Release by default
Or use Visual Studio and right click on your project component under Solution explorer, and click Pack.
If you got a Pack task error with .NET Core CLI or in Visual Studio, use Paket pack command:
paket pack --template [your-component-project]\[your-component-project].csproj.paket.template --build-config Release --symbols .\nupkgThe preferrable option is create a paket.local file in your consumer project/application, and add the source path of your package. The source property could be a path that contains a .nupkg file. In this case, you need build and pack your component first:
- Build/Pack your component project first
# Use Visual Studio: Build => Build Solution
# or use dotnet core CLI
dotnet build- Create the paket.local file in your consumer root solution project/application
paket.local
nuget [my-component-id] -> source [my-component-solution]\[my-component-project]\[nupkg-folder] version [my-component-version]For more information, see the official documentation: The paket.local file
After generated the .nupkg file, create a folder accessible to you (local directory or network share) as package repo:
Publish the package to local repo using nuget add:
nuget add [my-component.{version-number}].nupkg -source [your/local-repo/directory]Using Paket
Add your local folder like a source to the paket.dependencies file, in a project/application that will use this package like a dependency:
source D:\source\nuget_repo
source ~/source/nuget_repo
source \\server\nuget_repo
# Paket supports relative directory to the paket.dependencies too
source directory/relative/to/paket.dependenciesPS: Pay attention to avoid commit this file with the my/local/path to your CVS repository (like git). This is only to local tests.
If you wish add a commit with the hardcoded path, add a common directory for everyone, for example: C:\Program Files\Microsoft SDK\NuGetLocal
Add the packageId like a dependency into paket.dependencies file of your application:
Using Nuget
If your destiny project/application uses only Nuget like a package manager (without Paket), you can add the nuget repo folder mentioned above with Visual Studio:
For more information, see these tutorials:
Restore the project to provide authentication
nuget restorePush to the Azure Artifacts feed
# See the nuget.config file <packageSources> tag
nuget push -Source "[your-feed-name]" -ApiKey az [path/to/nupkg-file].nupkgUsing Paket
Add your remote feed URL like a source to the paket.dependencies file, in a project/application that will use this package like a dependency:
# [organization]: Your organization in Azure Devops
# [feed]: Your feed/server name, created in Azure Artifacts
source https://pkgs.dev.azure.com/[organization]/_packaging/[feed]/nuget/v3/index.json
# Paket supports relative directory to the paket.dependencies too
source directory/relative/to/paket.dependenciesAdd the packageId like a dependency into paket.dependencies file of your application:
# [YourAppProject]: Is project name inside of the solution, that to use this dependency like a reference
## Using dotnet core
paket add --project [YourAppProject]/[YourAppProject].csproj {YourComponent.PackageIdName}
## Using .NET Framework
.\.paket\paket.exe add --project [YourAppProject]/[YourAppProject].csproj {YourComponent.PackageIdName}As result will be added in the paket.dependencies file:
And in the [YourComponent]/paket.references file:
Using Nuget
If your destiny project/application uses only Nuget like a package manager (without Paket), you can add the remote feed URL mentioned above with Visual Studio:
Where:
For more information, see this official Microsoft tutorial:
Add the packageId like a dependency into package.config or using the tag <PackageReference> in the [YourComponent]\YourComponent.csproj XML file. You can do this using Visual Studio:
Right click on References under the component project => Manage Nuget Packages
See the wiki pages in: CsharpPackagetBase Wiki
| Back | FazBrowse Home | New Git URL |