Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

.NET Core app looks for package assembly path without dll extension

$
0
0

My ASP .NET Core app references the PDFSharp package. This package creates 6 dll files:

  • PdfSharp.Charting.dll
  • PdfSharp.dll
  • PdfSharp.Quality.dll
  • PdfSharp.Snippets.dll
  • PdfSharp.System.dll
  • PdfSharp.WPFonts.dll

When the app runs the code that depends on this package, it triggers the error:

Could not load file or assembly 'PdfSharp.System, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

It seems to be looking for the file without the .dll extension.

Process Monitor shows that it successfully loads PdfSharp.dll, but loading PdfSharp.System results in NAME NOT FOUND.

Process monitor output

Some solutions for this kind of issue suggest editing the HintPath in the .csproj file. My .csproj file doesn't contain any HintPaths, and the portion related to this package looks like this:

<ItemGroup><PackageReference Include="PDFsharp" Version="6.0.0" /></ItemGroup>

I don't know the right way to update this with a hint path, but I tried the following, and it made no difference (Process Monitor shows no attempt to load the file with the dll extension):

<ItemGroup><PackageReference Include="PDFsharp" Version="6.0.0" /><Reference Include="PDFsharp.System"><HintPath>.\PDFsharp.System.dll</HintPath></Reference></ItemGroup>

If I change the file name from PdfSharp.System.dll to PdfSharp.System, then the file is loaded successfully and the app works as expected.

However, I don't think this is the right way to solve this problem. Why is the app trying to load the file without the .dll extension? How is this determined? Is there a way to get the app to look for the file with the .dll extension?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>