C# library dll can't load 3rd party NuGet assembly - how to fix?

Geoff Caplan 0 Reputation points
2023-01-19T22:08:36.94+00:00

Hi

New to C# and MS Build.

I'm building a .dll Class Library in VS. The library uses a NuGet package.

The package works fine when testing inside the solution.

But when the library consumer tries to use the .dll it throws a FileNotFoundException when it fails to load the 3rd party library.

There is only the project .dll in my bin/debug folder, so clearly I'm not understanding something about the build process.

I assume that this is a newbie FAQ but but I've tried a fairly careful search and can't find a solution. There is no obvious way that I can see to configure the build in the project Properties.

The .csproj file contains the entry:


	<ItemGroup>
		<PackageReference Include="Stubble.Core" Version="1.10.8" />
	</ItemGroup>


This is a show-stopper, so any pointers would be much appreciated!

Crashed in OnStop with FileNotFoundException: Could not load file or assembly 'Stubble.Core, Version=1.10.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
Community Center | Not monitored
Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.