Skip to content

[One .NET] set $(PackageType) of DotnetPlatform#5636

Merged
jonathanpeppers merged 1 commit intodotnet:masterfrom
jonathanpeppers:packagetype-dotnetplatform
Feb 20, 2021
Merged

[One .NET] set $(PackageType) of DotnetPlatform#5636
jonathanpeppers merged 1 commit intodotnet:masterfrom
jonathanpeppers:packagetype-dotnetplatform

Conversation

@jonathanpeppers
Copy link
Member

Context: https://docs.microsoft.com/en-us/nuget/create-packages/set-package-type
Context: https://github.com/dotnet/runtime/blob/86d5d16d31ee46d619b4d9af510f307ed7da4846/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs#L142-L149

This is the pattern to follow for a package that is part of .NET that
people should not install directly. It prevents you from being able to
use @(PackageReference) for our packages -- which would not work
anyway.

If I review Microsoft.NetCore.App.Runtime.android-arm.nuspec, this
is how $(PackageType) is expressed within the .nupkg file:

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

We should set this for all .NET 6 .nupkg files we produce except for
Microsoft.Android.Templates, which uses PackageType=Template.

Context: https://docs.microsoft.com/en-us/nuget/create-packages/set-package-type
Context: https://github.com/dotnet/runtime/blob/86d5d16d31ee46d619b4d9af510f307ed7da4846/src/installer/tests/Microsoft.DotNet.CoreSetup.Packaging.Tests/NuGetArtifactTester.cs#L142-L149

This is the pattern to follow for a package that is part of .NET that
people should not install directly. It prevents you from being able to
use `@(PackageReference)` for our packages -- which would not work
anyway.

If I review `Microsoft.NetCore.App.Runtime.android-arm.nuspec`, this
is how `$(PackageType)` is expressed within the `.nupkg` file:

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

We should set this for all .NET 6 `.nupkg` files we produce except for
Microsoft.Android.Templates, which uses `PackageType=Template`.
@jonathanpeppers jonathanpeppers force-pushed the packagetype-dotnetplatform branch from c69a550 to 38f50ae Compare February 19, 2021 03:03

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<PackageType>DotnetPlatform</PackageType>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @rolfbjarne at some point, you might add this to the iOS/Mac packages. Just so people can't attempt to add a <PackageReference/> to them.

@jonathanpeppers jonathanpeppers merged commit cbf300d into dotnet:master Feb 20, 2021
@jonathanpeppers jonathanpeppers deleted the packagetype-dotnetplatform branch February 20, 2021 02:52
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants