Home

Nuget package with multiple dll fails to reference anything other then the main dll

edited March 2022

I have a custom Nuget package, on local machine source.
Contains 2 dlls, one is the main assembly and the other a supporting assembly (CCTools.Gen.dll).

Purpose of Nuget, quick "one stop bucket" for many of our custom dlls we reference from Linqpad.

When calling a method from the main dll, Linqpad fails

'FileNotFoundException: Could not load file or assembly 'CCTools.Gen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. 

The deployed Nuget spec file:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>TheTechZap.ZxvTools.Products.LinqPadTools.Common</id>
    <version>1.0.0</version>
    <title>TheTechZap LinqPad Tools Common</title>
    <authors>TheTechZap</authors>
    <owners></owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>2022-03-10_14-37-19, Common tools for powering LinqPad</description>
    <copyright>TheTechZap</copyright>
    <tags>LinqPad, code generation, generators, tools, database meta</tags>
    <dependencies>
      <group targetFramework="net6.0">
        <dependency id="LINQPad.Runtime" version="7.2.7" exclude="Build,Analyzers" ></dependency>
        <dependency id="Microsoft.EntityFrameworkCore" version="6.0.2" exclude="Build,Analyzers" ></dependency>
        <dependency id="System.Data.SqlClient" version="4.8.3" exclude="Build,Analyzers" ></dependency>
      </group>
    </dependencies>
  </metadata>
</package>

In the nuget package, the \lib\net.60 folder contains

TheTechZap.ZxvTools.Products.LinqPadTools.Common.dll
CCTools.Gen.dll

When I reference the same Nuget in a new standard XUnit project in VS, all works fine, and CCTools.Gen.dll is being referenced correctly.

In Linqpad running, Show assembly resolution log, does NOT contain CCTools.Gen.dll

Can anyone help please?

Comments

  • Have you perhaps changed the package without incrementing the version number? If so, LINQPad's package cache will still contain metadata applicable to the old version (packages are never supposed to change). Try rebuilding as 1.0.1, or prerelease version such as 1.0.0-test.1.

  • edited March 2022

    Thanks Joe. I figured it out. I think the problem is to do with dlls compiled using multiple frameworks in the nuget.

    1. Nuget package is targeting net6.0 only
    2. Specific DLLs referenced in the nuget package are netstandard2.0

    In LinqPad, the [.NET dropdown box] was on Auto.

    Fix:

    In LinqPad, the [.NET dropdown box], select net6.0, (or whatever specific version needed). Do not select auto.

Sign In or Register to comment.