Theo Brinkman
Theo Brinkman

Reputation: 311

NuGet Packages not putting dependencies into bin folder on Debug builds

Last year I did a upgrade project converting many internally developed codebases from VS 2008/2012 to VS 2022. In the process, I consolidated assembly versions, and converted to NuGet references.

Recently, we updated one of our web applications on the test server, and it couldn't load an assembly. After research it was determined that the assembly file was missing, because it wasn't copied into the bin folder during the debug build that had been deployed.

The assembly in question is being copied into place during a Release build, but I'm not having any luck so far figuring out why it isn't being copied during a Debug build.

Here's a genericized version of the .nuspec file that should bring the dependent assembly across.

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>My.Lib</id>
    <version>1.2.3.4</version>
    <authors>me</authors>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <!--<license type="expression">InternalUseOnly</license>-->
    <!-- <icon>icon.png</icon> -->
    <description>My.Lib NuGet Package</description>
    <releaseNotes>Initial package</releaseNotes>
    <copyright>2024</copyright>
    <tags>My.Lib</tags>
    <frameworkAssemblies>
        <frameworkAssembly assemblyName="Microsoft.CSharp" />
        <frameworkAssembly assemblyName="System" />
        <frameworkAssembly assemblyName="System.Core" />
        <frameworkAssembly assemblyName="System.Data" />
        <frameworkAssembly assemblyName="System.Data.DataSetExtensions" />
        <frameworkAssembly assemblyName="System.Xml" />
        <frameworkAssembly assemblyName="System.Xml.Linq" />
    </frameworkAssemblies>
    <dependencies>
      <group targetFramework="net48">
        <dependency id="itext" version="8.0.2" />
        <dependency id="itext.bouncy-castle-adapter" version="8.0.2" />
        <dependency id="Microsoft.Extensions.Logging" version="8.0.0" />
        <dependency id="Microsoft.Extensions.Logging.Abstractions" version="8.0.0" />
      </group>
    </dependencies>
  </metadata>
    <files>
        <file src="My.Lib\bin\Release\My.Lib.dll" target="lib\net48" />
        <file src="My.Lib\bin\Release\My.Lib.pdb" target="lib\net48" />
    </files>
</package>

The web project (asp.net framework 4.8) references the resulting NuGet package. The iText nor Microsoft.Extensions.Logging assemblies are being copied into the bin folder for Release builds, but not Debug builds, and I'm not sure why.

Can anybody point out what I've missed?

Upvotes: 1

Views: 80

Answers (0)

Related Questions