views:

40

answers:

2

Hi, I've compiled an application with vs 2008 and .net framework 3.5.

I tried to run this application on computer with only .net framework 4 (.net framework 3.5 is not installed) and I've got an error (says that it can't load the assembly ....ServiceModel.... version 3.0).

After installing .net framework 3.5 SP 1 it works.

I have found a documents says that .net framework is backward compatible: http://msdn.microsoft.com/en-us/library/ff602939.aspx

Am I missing something? I there a way to compile an application in vs 2008 and be able to run it on a computer with .net framework 4 only?

Thanks.

+2  A: 

From this MSDN page.

The .NET Framework 4 does not automatically use its version of the common language runtime to run applications that are built with earlier versions of the .NET Framework. To run older applications with .NET Framework 4, you must compile your application with the target .NET Framework version specified in the properties for your project in Visual Studio, or you can specify the supported runtime with the Element in an application configuration file.

So the best thing would probably be to install the 3.5 framework, but otherwise try changing the supportedRuntime element in the app.config.

ho1
What is this change?
Mattan
@Mattan: Look here for more info: http://msdn.microsoft.com/en-us/library/w4atty68.aspx
ho1
A: 

The .NET Framework 4 can run .NET Framework 2 and up applications. However, you have to install the full version of the framework. The general redistributable packages only ship with the "client profile" -- a subset of the available classes and methods in the framework.

Billy ONeal
I used the version from: http://msdn.microsoft.com/en-us/netframework/aa569263.aspx Is this version ok?
Mattan