I published my .net application using ClickOnce, and all my users get the following error message on trying to open the program:
\"Unable to install or run the appli
In my case, the problem caused this error message was of incorrect library publishing configurations.
When i set my library property CopyLocal = false, and then in project publish application files set Publish Status to Include, all works fine after project rebuilding and next publishing.
Thus we tell to ClickOnce compiler, not to publish this library with application by default, and by changing Publish State from Prerequisites to Include tells ClickOnce, not to search this library in GAC.
I found solution here:
http://ablogontech.wordpress.com/2009/01/02/unable-to-install-or-run-the-application-the-application-requires-that-the-assembly-be-installed-in-the-global-assembly-cache-gac-first/
Excerpt from wordpress link:
I recevied this error while compiling my first C# production application. I had to do the following in Visual Studio for the project:
- In Solution Explorer, expand the References node and click the assembly listed in the error. Ensure Copy Local in the Properties grid is set to ‘True’.
- In the properties of the project, Publish | Application Files Tab, ensure the Publish Status for the assembly listed in the error is set to ‘Include’
if two version of the same dll referred across the dependent projects then that would be one of the root cause of the error.
It happened to me and complaining about NLog.dll, What I found is that my app referred one version of Nlog.dll and my library projects referred another version of Nlog.dll and manifest listed one version as dependency(install) and another version as dependency(requisite i.e. need to be present in the system even copy to local set to true).
You should also check that there is no wrong assembly binding redirection in your app.config
file. Look for a node looking like:
<dependentAssembly>
<assemblyIdentity name="Telerik.Windows.Data" publicKeyToken="--SomePublicToken--" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.0.2.0" newVersion="3.0.2.0"/>
</dependentAssembly>
and ensure the range old
to new
makes sense, or simple, that this node makes sense at all. My first try would be to simply delete it and check again. It can happen that some NuGet packages mess with the config file in old version and this node is not needed anymore in newer once (and it's not deleted automatically).