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

Procedure for changes involving NuGet Packages

  1. Implement all changes necessary in the NuGet package project. Remember to update the package version, assembly version and file version so they match.
  2. Submit a pull request on these changes only. No implementation on other projects should be included.
  3. Once pull request is approved and changes are merged into master; create and publish new NuGet package based on master branch.
  4. Continue with implementation, referencing the updated package wherever it is needed.
  5. 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>
  1. Save the changes
  2. Open a command line utility like git bash, powershell or cmd.
  3. Navigate to the project folder.
  4. Build the project using Release configuration:
    dotnet build -c Release
  5. 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.
  6. Navigate to the release folder.
  7. 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
  8. Your package will now be published to nuget.org