1
votes

I was trying to run NUnit with framework 4.5 (I have VS2010 and VS2012 installed on my machine).

So I tried the old approach by editing the .exe.config file for nunit

I noted the framework version as 4.5.50709. However this failed at runtime; saying that the specified version isn't available and prompt to download and install.

Quick internet check states the registry is the place to look HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP

No 4.5 fwk folder. Strange - so I repaired the framework 4.5 installation. Still the same. Finally I delve into the 4.0 key I find

InstallPath = %WINDOWS%\Microsoft.Net\Framework64\v4.0.30319
TargetVersion = 4.0.0
Version = 4.5.50709

Hmmm looks like 4.5 has overridden 4.0. So I modified the .exe.config

<supportedRuntime version="v4.0.30319" />

This worked. Nunit now reports that it is running on v4.5

  • Why does 4.5 install in this manner ?
  • It seems to be 'redirect'ing - Is this because 4.5 is an in-place update ? If yes, why doesn't specifying 4.5.50709 not work ?
1

1 Answers

4
votes

Just like .NET 3.0 and 3.5, .NET 4.5 is an in-place update. In other words, it replaced the original 4.0 install. The CLR version number is still 4.0 and so are all of base assemblies.

So you do have to select 4.0 in the app.exe.config file. You can make it more specific and refuse to run the test when 4.5 is not present by using the sku attribute, but there's little point to it, the test should fail anyway.