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

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
 
M

Mattias Sjögren

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
 
S

Steve Franks

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
 
M

Mattias Sjögren

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top