views:

185

answers:

4

Users are not able to install a ClickOnce application. The error is: "File NLog.dll is not a valid Portable Executable (PE) file." It works fine on my machine, but I have nLog installed. That's not possible for client machines. Any ideas how to get this to work?

A: 

same problem. any ideas?

wiedsche
I never found one. I ended up removing NLog and writing my own logger (obviously much simplified) :(
Brian
+1  A: 

Check your build option and make sure NLog.dll is included in the "Application Files", so that it will be in "download group"/required.

PerlDev
This is most likely the problem since NLog should just be another dll that you can include. Log4Net works this way.
ShaneC
Thanks but the dll does get downloaded, it just gives an error.
Brian
A: 

Add the dll to your project and set BuildAction = None, and "copy to output directory" as "do not copy".

Delete your reference to NLog in your project. Re-add the reference and point it to the dll you just added to the project. On the properties of the reference, set "Copy local" to "true".

Now when YOU run the application, it will point to the local version, and when you deploy the application, it will deploy the local version and point to it.

This works for many 3rd party DLL's, but not all. The best thing to do is to try it.

RobinDotNet
Thanks but the dll does get downloaded, it just gives an error.
Brian
How is it referenced in your project? I'm going to have to dredge my memory, I remember something about the portable execution error... You did change your project to reference it the way I've said here?
RobinDotNet
Here's a post from the MSDN forum -- see if this helps you at all: http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/dc47dac1-6eb2-4533-a119-c1d87a36c4a5/
RobinDotNet
+1  A: 

I put all the NLog config data into the App.config file instead of the NLog.config file and it worked for me after deploying with ClickOnce as well. No errors and the logging was working on the deployed application.

smallone