1
votes

My app has a Target .NET Framework of 3.0.

I have a PC with a fresh install of Windows XP SP3. Next, I installed .NET Framework 4.0 Full on it.

When I try to run my ClickOnce-deployed app, I get the "Failed to load the runtime" error:

[9/9/2011 11:39:53 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)

It is my understanding that apps Targeting .NET 3.0 should work on machines that have .NET 4.0 installed. What is causing this error? Must I install .NET Framework 3.5 SP1 on Windows XP Machines?

3
I think I may write a custom Prerequisite and A) Check if user has .NET Framework 3.0 installed. (fresh XP won't have it, fresh Vista will have it, fresh Win 7 will have it) B) If .NET 3 is not installed, install 3.5.yarone
OK, that worked. Why the app doesn't just run properly (on XP SP3 with .NET 4.0) doesn't make sense to me.yarone

3 Answers

3
votes

yes I would install the .NET Framework 3.5 and try again, if it does not work I would install the 3.0 ( Microsoft .NET Framework 3.0 Redistributable Package ).

.NET 3.5 SP1 and .NET 4 are both present in the machines we deploy our applications to.

Edit:

also check these questions:

What .NET Framework version should I ship with; 2, 3, 3.5?

Is .net framework 2.0 required if 3.5 is installed?

1
votes

As Davide Piras mentioned you need to install .NET 3.0. The reason why you need to do is that .NET 4 is not a dependency superset of the 3.5/3.0/2.0 libraries.

.NET 3.5 is 3.0 libraries plus some additional ones. .NET 3.0 is the 2.0 libraries plus some additional ones

However, .NET 4 is a whole new set of libraries that exist in parallel to the 2.0/3.0/3.5 ones. I believe that this is a result of the .NET 4 using a new CLR runtime than 2.0/3.0/3.5. The 2.0/3.0/3.5 all use the same runtime, hence each new version required the install of the prior versions.

0
votes

It's a COMException, so I'd say that maybe a component is not properly set.

Check your project properties under the publish tab. In Application Files, check Show All Files and make sure that all you need is marked as included.

In there, you can also ask the application to download the required components (such as the proper framework).

Such misleading error message happened to me in the past. May also just be the framework as the other reply states.