Application requires log4net assembly be install i

2019-05-28 18:22发布

问题:

When trying to install a VS2015 console app onto one of my servers, I get this error:

http://imgur.com/kGI9MIJ

On another server it installs a runs just fine and the only difference I can see between the two is the the server that it does install on, has two log4net.dll in GAC. One has processor architecture of AMD64 and the other x86. And the server that the program does not install on only has the AMD64 dll. How can I install the x86 version?

I have tried regsvr32 log4net.dll command, but this give me this error:

http://imgur.com/HGStqD8

Tried to drag and drop the dll to the assembly folder and says "Access Denied".

Is there a something I need to change in VS2015 before publishing?

回答1:

you should install it into GAC using Gacutil.exe. Like this:

gacutil /i (path to dll)\log4net.dll

for additional documentation, see here

gacutil can be found here

C:\Program Files (x86)\Microsoft SDKs\Windows\xxxx\bin\NETFX yyyTools

where xxx is windows version (ie 8.1a) and yyy .net framework version (ie 4.6.1)

EDIT: call gacutil.exe from Developer command prompt

Start -> Visual Studio 2015 Visual Studio Tools -> Developer Command Prompt for VS2015


回答2:

Problem solved.

First I tried the answer from Nino and gacutil.exe is not installed on that server, so I could not run that cmd.

After going through the project in Visual Studio 2015 properties/Publish settings, under Install Mode and settings, click button "Application Files..." and make sure that dll file is "included" in publishing. The dll i needed was not included, but after including it, re-published, everything installed just fine.