ClickOnce Application throws error "..requires assembly MySql.Data Version 6.5.4.0 be installed in the Global Assembly Cache (GAC) first."

11,547

Solution 1

A solution would be to include the MySQL dll as part of your application. Set the dll to "include local" and/or "include" under the Publish Application settings.

This way when your ClickOnce app is deployed, the dll is deployed locally along with it and will NOT look for it in the GAC.

Typically, things in the GAC are installed there for other applications to share and as far as ClickOnce is concerned, are usually installed as prerequisites. Not having to include a component with your application reduces the size of your deployment, of course, as well as allowing your application to use that component that is already shared in the GAC.

The problem you are having apparently has something to do with ClickOnce and WinXP and the solution would be to just include the MySQL component with your application and use it locally to your app.

Solution 2

Thought I'd add my answer in case it helps anyone else. It ended up that a MySql.Data.dll file was an older version in a sub-project that was being used for the current project in the solution. In other words, my solution is set up like this:

  • Project 1 - Class Library (used for several other projects; not built often), contains reference to MySql.Data v6.9.4
  • Project 2 - Main program, references Project 1, also contains reference to MySql.Data v6.9.7

When compiling/publishing Project 2, it wasn't happy that v6.9.4 was not present in the GAC. So, all I had to do was remove the v6.9.4 in Project 1 and change the reference to the MySql.Data v6.9.7 that was being used in Project 2. Thus, whenever I update one, they both get updated. After that, I just rebuilt Project 1 and re-published Project 2 and it worked just fine.

My advice would be to check all references within your main app and make sure that any sub-projects/class libraries also reference the same versions of the DLLs you're using (if that makes sense).

Hope this helps someone else!

Share:
11,547

Related videos on Youtube

Rachel Fee
Author by

Rachel Fee

Updated on June 29, 2022

Comments

  • Rachel Fee
    Rachel Fee almost 2 years

    I'm new to deploying .NET apps, so please let me know if any more details are required.

    I developed a C# console app in Visual Studio with MySql. This was deployed on 2 Windows 7 machines via ClickOnce Application and works fine. Tried to install in on a Windows XP machine and got the following error:

    System Update Required:

    Unable to install or run the application. The application requires that assembly MySql.Data Version 6.5.4.0 be installed in the Global Assembly Cache (GAC) first.

    I've done some googling and I don't think it's any of the issues that have been mentioned - no firewall, no antivirus, on Administrator account with all permissions. I checked C:\Windows\Assembly and MySql.Data.CF.dll V 6.5.4.0 is listed.

    Coworker also dug up the following error log:

    PLATFORM VERSION INFO Windows : 5.1.2600.196608 (Win32NT) Common Language Runtime : 4.0.30319.1 System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100) clr.dll : 4.0.30319.1 (RTMRel.030319-0100) dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100) dfshim.dll : 4.0.31106.0 (Main.031106-0000)

    SOURCES Deployment url : file:///C:/GearBox/app/publish/ClockworksConsoleApplication.application Application url : file:///C:/GearBox/app/publish/Application%20Files/ClockworksConsoleApplication_1_0_0_6/ClockworksConsoleApplication.exe.manifest

    IDENTITIES Deployment Identity : ClockworksConsoleApplication.application, Version=1.0.0.6, Culture=neutral, PublicKeyToken=efa8c6cf1fc52128, processorArchitecture=msil Application Identity : ClockworksConsoleApplication.exe, Version=1.0.0.6, Culture=neutral, PublicKeyToken=efa8c6cf1fc52128, processorArchitecture=msil, type=win32

    APPLICATION SUMMARY * Installable application.

    ERROR SUMMARY Below is a summary of the errors, details of these errors are listed later in the log. * Activation of C:\GearBox\app\publish\ClockworksConsoleApplication.application resulted in exception. Following failure messages were detected: + Failed to load the runtime. (Exception from HRESULT: 0x80131700)

    COMPONENT STORE TRANSACTION FAILURE SUMMARY No transaction error was detected.

    WARNINGS There were no warnings during this operation.

    OPERATION PROGRESS STATUS * [8/31/2012 9:56:00 AM] : Activation of C:\GearBox\app\publish\ClockworksConsoleApplication.application has started. * [8/31/2012 9:56:02 AM] : Processing of deployment manifest has successfully completed. * [8/31/2012 9:56:02 AM] : Installation of the application has started. * [8/31/2012 9:56:02 AM] : Processing of application manifest has successfully completed. * [8/31/2012 9:56:08 AM] : Found compatible runtime version 2.0.50727.

    ERROR DETAILS Following errors were detected during this operation. * [8/31/2012 9:56:08 AM] System.Runtime.InteropServices.COMException - Failed to load the runtime. (Exception from HRESULT: 0x80131700) - Source: System.Deployment - Stack trace: at System.Deployment.Application.NativeMethods.IClrMetaHostPolicy.GetRequestedRuntime(MetaHostPolicyFlags policyFlags, String binaryPath, IStream configStream, StringBuilder version, Int32& versionLength, StringBuilder imageVersion, Int32& imageVersionLength, Int32& pdwConfigFlags, Guid interfaceId) at System.Deployment.Application.NativeMethods.GetAssemblyCacheInterface(String CLRVersionString, Boolean FetchRuntimeHost, CCorRuntimeHost& RuntimeHost) at System.Deployment.Application.PlatformDetector.VerifyPlatformDependencies(AssemblyManifest appManifest, AssemblyManifest deployManifest, String tempDir) at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp) at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc) at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl) at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

    COMPONENT STORE TRANSACTION DETAILS No transaction information is available.

    I was previously getting another error at install,

    URLDownloadToCacheFile failed with HRESULT '-2146697211' Error: An error occurred trying to download 'http://station52/clockworksEXE/ClockworksConsoleApplication.application'.

    however, I changed my settings to publish from CD instead of website and it seems to have solved this, but I'm still getting the GAC error.

    Any ideas?

    • Brad Rem
      Brad Rem over 11 years
      Can you include the mysql dll as part of your application? I think you set the dll to "include local" and/or "include" under the Publish Application settings.
  • Rachel Fee
    Rachel Fee over 11 years
    I see what you mean, but it's not even listed in that file. I ended up including a local copy of the DLL with the release and it worked. Thanks!
  • Der_Meister
    Der_Meister over 9 years
    You also need to ensure that all dependent projects use the same assembly version as the published app.I got SomeLibrary v1 as an included dependency and SomeLibrary v2 as a prerequisite.