Nuget Package
Overview of nuget package usage in altinn studio
Altinn 3 NuGet Packages
Altinn 3 has published a number of nuget packages to share common libraries between different solutions. You can read more about nuget here.
The following nuget packages are available for download here
- Altinn.App.Api
- Altinn.App.Common
- Altinn.App.PlatformServices
- Altinn.Common.PEP
- Altinn.Authorization.ABAC
- Altinn.Platform.Storage.Interface
- Altinn.Platform.Models
- JWTCookieAuthentication
- Altinn.Common.AccessToken
- Altinn.Common.AccessTokenClient
Procedure for changes involving NuGet Packages
- Implement all changes necessary in the NuGet package project. Remember to update the package version, assembly version and file version so they match.
- Submit a pull request on these changes only. No implementation on other projects should be included.
- Once pull request is approved and changes are merged into master; create and publish new NuGet package based on master branch.
- Continue with implementation, referencing the updated package wherever it is needed.
- Remember to update all outdated references to the package and check that all tests run successfully before submitting a final PR.
Creating a NuGet package
Detailed documentation on how to create a NuGet package, guidelines etc can be found here.
An example of nuget package creation
Open the project csproj file to edit it as an xml file:
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>Library</OutputType>
<Version>4.14.0</Version>
<AssemblyVersion>4.14.0.0</AssemblyVersion>
<PackageId>Altinn.App.PlatformServices</PackageId>
<PackageTags>Altinn;Studio;App;Services;Platform</PackageTags>
<Description>
This class library holds most of the Altinn App business logic and clients for communication with the platform.
</Description>
<PackageReleaseNotes>https://docs.altinn.studio/community/changelog/app-nuget/</PackageReleaseNotes>
<Authors>Altinn Platform Contributors</Authors>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Altinn/altinn-studio</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsPackable>true</IsPackable>
<!-- SonarCloud requires a ProjectGuid to separate projects. -->
<ProjectGuid>{98E6200A-ED99-418E-B30C-81BA564B509A}</ProjectGuid>
</PropertyGroup>
- Save the changes
- Open a command line utility like git bash, powershell or cmd.
- Navigate to the project folder.
- Build the project using Release configuration:
dotnet build -c Release
- Pack the project into a NuGet package:
dotnet pack -c Release --include-source -p:SymbolPackageFormat=snupkg
The package will now be created in {projectfolder}\bin\Release. - Navigate to the release folder.
- Publish the package:
dotnet nuget push Altinn.Platform.Storage.Interface.2.5.10.nupkg -k [nuget api key] -s https://api.nuget.org/v3/index.json
- Your package will now be published to nuget.org