Unable to install or run the application: Click Once

主宰稳场 提交于 2019-11-30 07:59:20
David Shochet

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:

  1. 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’.
  2. 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’

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.

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).

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).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!