FileNotFoundException for NuGet package
Asked Answered
E

1

6

I downloaded and installed the NuGet Package: Select.Pdf. At runtime, when I click on the button that utilizes the code using the Select.Pdf namespace, I get the following exception:

enter image description here

The package is in the proper file directory and is properly installed, as you can see via the packages.config file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="Select.Pdf" version="16.4.0.1" targetFramework="net452" />
</packages>

I've been fighting with this for 2 weeks and I'm pretty much over it. Has anyone ever encountered this? Does anyone know how to fix this?

Exciseman answered 18/11, 2016 at 16:38 Comment(6)
I should also point out that I have uninstalled and reinstalled multiple times. I actually switched to this package because I was having the EXACT same problem with PDFSharp.Exciseman
Please check whether Nuget package restore is enabled , and the packages are restored properly. The version you are using in code and referencing can also cause mismatch.Cartwheel
@Cartwheel can you elaborate on that a little more? How do I do/check that? This is literally the first time I'm using NuGet packages, so i'm on Supreme Rookie Mode...Exciseman
A folder called packages will be added in the folder where sln file exists when you build the solution or restore nuget packagesCartwheel
Also,check the reference path to the assembly in your project file and the actual location of the assembly are same. If both proj and sln files are in same folder then it will packages/select.pdf in your project fileCartwheel
Thanks man. Got it going. If you want to move your comment to an answer, I can accept it.Exciseman
C
1

Possible fixes for this issue:

  • Please check whether Nuget package restore is enabled and the packages are restored properly.

A folder called packages will be added to the folder where the solution file (.sln) exists when you build the solution or restore NuGet packages.

  • Please check the reference path to the assembly in your project file and the actual location of the assembly is same.

If both project (.csproj) and solution(.sln) files are in the same folder then it will be packages/select.pdf in your project file

  • The version you are using in code and referencing can also cause the mismatch.

Ensure the assembly version restored and referred in the project file are same.

Cartwheel answered 23/11, 2016 at 3:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.