Skip to content

NuGetizer v0.9.1 packing reference assembly instead of real assembly #263

@RichardD2

Description

@RichardD2

Describe the Bug

I have a .NET Framework 4.8 project using NuGetizer 0.9.1 which is set up to generate a package on the release build.

Since upgrading to VS2022 v17.4, the generated package contains the reference assembly version of System.Buffers, despite the project having an explicit reference to that package.

Steps to Reproduce

Create a new console application. Add references to System.Memory, System.Buffers, and NuGetizer. Set the package ID and the "generate package on build" flag.

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net48</TargetFramework>
        <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
        <PackageId>TestNuGetizer</PackageId>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="System.Buffers" Version="4.5.1" PrivateAssets="all" />
        <PackageReference Include="System.Memory" Version="4.5.5" PrivateAssets="all" />
        <PackageReference Include="NuGetizer" Version="0.9.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
    </ItemGroup>
</Project>

Build the project.

Open the generated nupkg file in NuGet Package Explorer.

Extract lib/net48/System.Buffers.dll from the file.

Observe that the file is the reference assembly, not the real assembly. Specifically, the reference assembly is 15Kb whereas the real assembly is 21Kb. If you open the file with a decompiler, you will see there are no bodies defined for any methods or properties.

Expected Behavior

The generated nupkg file should contain the real assembly.

Version Info

NuGetizer v0.9.1 (latest stable)
VS2022 v17.4.1

Additional Info

The same project generated the correct package in VS v17.3.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions