pertz
pertz

Reputation: 393

.NET Runtime Version Issue (supportedRuntime)

First, I´ve found a few questions on this topic but none seem to address exactly my issues, but feel free to point to an existing question if you feel it does answer my questions.

My problem: I am building a C# .NET app that depends on .NET Framework 3.5 or above. My main problem is on the "or above" part.

The app was working perfectly if the target machine had exactly the version 3.5 installed (and I hadnt changed anything on the app.config). But now I tested on a machine that has 4.0 only (ie, doesnt have 3.5) and it didnt work, it says:

"Unable to find a version of the runtime to run this application."

And, btw, my installer detects that there is a compatible .NET version (ie, a version >= 3.5), so it allows the app to install, but it wont run after installed.

Then researching I found out that you had to change app.config and add the other .NET Framework versions, so I added:

supportedRuntime version="v4.0.30319"

(full app.config:

 <?xml version="1.0"?>
    <configuration>
    <startup>
      <supportedRuntime version="v4.0.30319"/>
      <supportedRuntime version="v2.0.50727"/>
    </startup>
    </configuration>

)

After I added this, I started getting warnings saying "Could not find schema information for the attribute "version" (and element "supportedRuntime")", and when I run it on the .NET-4.0-only-machine it will give me the same error message as before.

My project is set to 3.5 as target-runtime on project properties.

Any ideas?

Thanks in advance.

Upvotes: 2

Views: 6695

Answers (1)

Steve Danner
Steve Danner

Reputation: 22148

I've never seen anyone specify .NET 4 in the app.config as "v4.0.30319", you only need to specify it as "v4.0". See this page for more.

Changing that should take care of your problem.

Upvotes: 3

Related Questions