A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/nuget/create-packages/set-package-type below:

Set a NuGet package type

Packages can be marked with one more more package types to indicate its intended use.

Known package types

Packages not marked with a type, including all packages created with earlier versions of NuGet, default to the Dependency type.

Note

Support for package types was added in NuGet 3.5. If you don't need a custom package type, it's best to not explicitly set the package type. NuGet defaults to the Dependency type when no type is specified.

Custom package types

You can mark your package with one or more custom package types if its use does not fit the known package types.

For example, imagine that customers of the Contoso app can install extensions. The app could require extension authors to use the custom package type ContosoExtension to identify their packages as proper extensions that follow the required conventions.

Warning

A package with a custom package type cannot be installed by Visual Studio or nuget.exe. See NuGet/Home#10468 for more information.

Package types can be set in the project file (.csproj):

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    
    <PackageType>ContosoExtension</PackageType>
  </PropertyGroup>

</Project>

Packages with multiple intended uses can be marked with multiple package types using the ; delimiter:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    
    <PackageType>PackageType1;PackageType2</PackageType>
  </PropertyGroup>

</Project>

Package types can be versioned using a , delimiter between the package type and its Version string:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    
    <PackageType>PackageType1, 1.0.0.0;PackageType2</PackageType>
  </PropertyGroup>

</Project>

Package types are set in the .nuspec file within a packageTypes\packageType node under the <metadata> element:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <!-- ... -->
        <packageTypes>
            <packageType name="ContosoExtension" />
        </packageTypes>
    </metadata>
</package>

Packages with multiple intended uses may be marked with multiple package types:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <!-- ... -->
        <packageTypes>
            <packageType name="PackageType1" />
            <packageType name="PackageType2" />
        </packageTypes>
    </metadata>
</package>

Package types can be versioned using a Version string:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <!-- ... -->
        <packageTypes>
            <packageType name="PackageType1" version="1.0.0.0" />
            <packageType name="PackageType2" />
        </packageTypes>
    </metadata>
</package>

The format of a package type string is exactly like a package ID. That is, a package type is a case-insensitive string matching the regular expression ^\w+([_.-]\w+)*$ having at least one character and at most 100 characters.

If provided, the package type version is a Version string. The package type version is optional and defaults to 0.0.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4