Altinn.FileAnalyzers 9.0.0-preview.1

This is a prerelease version of Altinn.FileAnalyzers.
dotnet add package Altinn.FileAnalyzers --version 9.0.0-preview.1
                    
NuGet\Install-Package Altinn.FileAnalyzers -Version 9.0.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Altinn.FileAnalyzers" Version="9.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Altinn.FileAnalyzers" Version="9.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Altinn.FileAnalyzers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Altinn.FileAnalyzers --version 9.0.0-preview.1
                    
#r "nuget: Altinn.FileAnalyzers, 9.0.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Altinn.FileAnalyzers@9.0.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Altinn.FileAnalyzers&version=9.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Altinn.FileAnalyzers&version=9.0.0-preview.1&prerelease
                    
Install as a Cake Tool

Altinn File Analyzers

GitHub release (latest SemVer including pre-releases) GitHub last commit GitHub

This library contains code for doing deep file analysis based the actual binary data of files uploaded to an instance in Altinn 3. The implementation is two folded, one part that analyses and another part that validates against the analysis results. The reasoning for this split is to be able to use only the analyzer and extract metadata without validating. In addition it will be simpler to configure validators against a standardized result set rather than embed that into the analysis code.

The Getting started section describes the basic steps required in order to use this package within an Altinn 3 application. For a more comprehensive description of file analyzers in Altinn 3 please see https://docs.altinn.studio/app/development/logic/validation/files/. <hr> <br/>

Getting started using the package

This guide assumes you have an existing Altinn 3 application. If not please see https://docs.altinn.studio/app/getting-started/create-app/ to get started.

  1. Add reference to Altinn.FileAnalyzers nuget package
    Open command line to the repo of your application and navigate to the App folder where the App.csproj file is located and run the following command:

    nuget install Altinn.FileAnalyzers
    
  2. Register the analyzers you would like to use Each analyzer/validator has it's own method for registering required services. Se table below for available analyzer.

    services.AddMimeTypeValidation();
    
  3. Configure the the analyzer for the datatype it should be used for The analyzer is configured on a per datatype basis and will only run against the configured datatype. The example below configures the mime type analyzer and it's corresponding validator.

       {
          "id": "08112113-cc3a-4d35-a8d2-bfba53a1ddfd",
          "allowedContentTypes": ["image/jpeg", "application/pdf"],
          "taskId": "Task_1",
          "maxSize": 25,
          "maxCount": 1,
          "minCount": 1,
          "enablePdfCreation": false,
          "enabledFileAnalysers": [ "mimeTypeAnalyser" ],
          "enabledFileValidators": [ "mimeTypeValidator" ]
       }
    

Available analyzers and their corresponding validators

Analyzer Id Validator Id Description
mimeTypeAnalyser mimeTypeValidator Checks if a file is actually the MIME type it claims to be. This uses the Mime Detective library to determine the mime type.

Automated tests

Contributing

License

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.0.0-preview.1 45 9/9/2026
8.0.0 7,427 9/18/2025
8.0.0-rc.1 604 7/2/2025
0.5.0 5,165 6/16/2023
0.5.0-preview.3 605 6/8/2023
0.5.0-preview.2 251 6/5/2023
0.5.0-preview.1 261 6/5/2023