How to control what framework version is used for an assembly?

  • Thread starter Thread starter Steve Franks
  • Start date Start date
S

Steve Franks

Is there an option within Visual Studio where you tell it what version of
the framework you are targetting?

I'd like to use Visual Studio 2005 to compile my assembly (C# class
library), but I want to to tell VS that I want my compiled assembly to work
with the original 1.0 framework, and then have it produce an assembly that
will run in that environment ok, and warn me if at any time I use a class or
other function that is not available under my target framework. Is this
possible?

In other words, I am trying to build an assembly that is compatible with all
versions of the .NET framework, but I want to use Visual Studio 2005 to
compile it? By using VS 2005 and I automatically forcing my assembly to
require the .NET framework 2.0 - even if I am using just generic .NET code
that is compatible with .NET 1.0?

The bottom line is that I am not using any special features of the later
frameworks. I want to use the latest VS 2005 to compile, but yet make sure
the assembly works with framework 1.0. How can this be done?

Thanks,

Steve
 
I'd like to use Visual Studio 2005 to compile my assembly (C# class
library), but I want to to tell VS that I want my compiled assembly to work
with the original 1.0 framework, and then have it produce an assembly that
will run in that environment ok, and warn me if at any time I use a class or
other function that is not available under my target framework. Is this
possible?

Officially no, but have a look at
http://weblogs.asp.net/rmclaws/archive/2005/06/04/410360.aspx



Mattias
 
Thank you. I was hoping there was a way to create a 2.0 framework assembly,
but have it automatically still run within earlier versions of the framework
if 2.0 was not available. Seems feasable if one stays away from 2.0
specific functionality when coding, but I guess not.

Steve
 
Thank you. I was hoping there was a way to create a 2.0 framework assembly,
but have it automatically still run within earlier versions of the framework
if 2.0 was not available. Seems feasable if one stays away from 2.0
specific functionality when coding, but I guess not.

Unfortunately not, all the v2 compilers produce metadata that the
older runtimes don't understand.



Mattias
 
Back
Top