Could not load file or assembly 'NuGet.Server,

2019-08-25 02:49发布

So I have created a NuGet Server via an ASP.Net Web Application following this tutorial: http://nugetserver.net/ which is hosted in IIS. I have placed the files on my D: drive on my server along with my packages.

IIS Sites Virtual Path:enter image description here

I get the following error when I navigate to the url: enter image description here

In case the picture is not clear enough, please see below:

Could not load file or assembly 'NuGet.Server, Version=2.11.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Here is my project's web.config file along with my publishing profile: enter image description hereenter image description here

My target .NET Framework version is 4.6 but the packages themselves are those of an earlier version of .NET. Could this be the problem? I took the project folder and put it on my physical path on my local machine and it works just fine when I run the project in debug mode. Please see screenshot below:

NOTE: I have to hide the package names due to organizational confidentiality policies.enter image description here

I am pointing to these package files:

D:\Backup\Dropbox\vox_server_01\nuget\Packages

The reason I am creating this NuGet server is because the existing one is buggy.enter image description here

Could this be a permissions thing to the users group in IIS? This link Could not load file or assembly 'someProject' or one of its dependencies. Access is denied lead me to that question. Any suggestions on how I can get around this?

Update: Here are my package sources below: enter image description here

3条回答
聊天终结者
2楼-- · 2019-08-25 02:54

If in your Web.config you have a reference to this NuGet.Server package, delete it from the file and try running again. Fairly similar to a BadImageFormatException from a bad reference in the web.config

查看更多
来,给爷笑一个
3楼-- · 2019-08-25 03:03

Came here because of the same problem. Funny enough, I had my solution named "Nuget.Server" as well. Changing my Assembly name (under project properties) fixed it. Renamed it to "NugetServer"

Change assembly name under project properties

查看更多
你好瞎i
4楼-- · 2019-08-25 03:16

I could not replicate your error, but here are some notes how nuget server problems can be solved:

The packagesPath key in web.config can be left blank, as you are already using the default folder \Packages.

When deploying to the server, you might find an error in the line of Access to the path server.cache.bin is denied. Just create a blank file with that name on your server.

查看更多
登录 后发表回答