Search code examples
c#asp.net-mvcvisual-studionuget

How do I Install, Update, Register a Nuget package on the Web Server that does not have Nuget or Visual Studio installed?


The code works fine on my development machine, but I get an error when I try running it on the server:

Could not load file or assembly 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I understand that I need to install this assembly, but the directions to install it say to use Package Manager Console.

This is a server that isn't running anything but IIS.

I'm a contractor, so I don't want to the company and tell them that they have to buy Visual Studio for this server unless I really have to.

screenshot


Solution

  • I got it to work by manually copying over files that had recently changed in the project.

    That would be the DLL in the bin folder, any of the *.cshtml files that were changed (as seen in the TFS Change History), and manually copy over any NuGet packages from my development PC to the web server.

    For example: In the error posted in the original question, I simply located Microsoft.CodeDom.Providers.DotNetCompilerPlatform in the packages folder of my PC and replaced that same existing file on the web server.

    It doesn't seem like the preferred technique to me, but that's what this company has in place.