C# – ClickOnce Application throws error “..requires assembly MySql.Data Version 6.5.4.0 be installed in the Global Assembly Cache (GAC) first.”

asp.netcMySQLnetwindows

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?

Best Answer

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.

Related Topic