Reputation: 38025
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?
Upvotes: 2
Views: 2660
Reputation: 273264
If your NLog assemblies are deployed to the GAC then you can't (simply) include that in a ClickOnce setup. Try to deploy them as local DLLs. If that is not possible you will need a separate Setup (or MSI) to deploy NLog.
Upvotes: 2
Reputation: 6553
I found the answer to this issue when your NLog.config
would not be copied to your program if installed using ClickOnce
.
You need to select the NLog.config
file in your Project
using Solution Explorer
and set its Properties
as follows:
Now when you deploy using ClickOnce
the files should be copied over as well! :)
Upvotes: 8
Reputation: 71
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.
Upvotes: 7
Reputation: 11877
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.
Upvotes: 0
Reputation: 437
Check your build option and make sure NLog.dll is included in the "Application Files", so that it will be in "download group"/required.
Upvotes: 3