Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

What establishes the framework an assembly runs under?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Franks - 08 Jul 2005 16:37 GMT
Does anyone know what establishes the framework an assembly will run under?
For example, when I look at my custom assembly (C# library) in the GAC, the
Runtime column shows it will run under the .NET framework version 1.1.4322.
How is the GAC determining/setting this?  I did not explictly do anything in
my code or build options to specify this.  On my machine I have frameworks
1.0, 1.1 as well as 2.0 beta.

My assembly was created using Visual Studio 2003 - does this have something
to do with it?

Now, what would happen if I tried to run that same assembly under framework
1.0?  Would it run or error out?

Likewise I'm thinking that if I recompile my assembly under Visual Studio
2005 beta 2 that the runtime would change to v2.0.  However, again, would
this mean that the assembly would not run on  a machine that did not have
the 2.0 framework installed?  I am not using any particular features that
are specific to 2.0 (or even 1.1 for that matter)?

Along these same lines, how does one use the latest version of VS.NET (say
2005 beta 2) and yet still make sure that their assembly will run on
framework 1.0?

Thank you!

Steve
Cowboy (Gregory A. Beamer) - MVP - 08 Jul 2005 17:36 GMT
The GAC determines framework by which compiler was used. If you use the 1.0
compiler, it is 1.0 and is 1.1 if not.

To use an assembly across frameworks, you need a service wrapper. You
cannot, at least without a major fudging, use a 1.1 assembly in a 1.0
project. There are some exceptions to this rule, of course, as 1.0 ASP.NET
assemblies can be dropped in a 1.1 project (if there are no breaking IL
changes - stay away from XML), but they will be treated as 1.1 if you do
this, not 1.0. The GAC is different, however, as it more firmly bonds the CLR
version to the assembly.

To the final quesiton. If you are using 2.0, you will have to stay away from
using any new code that cannot compile to 1.0 ... or, you will have to wrap
your code inside of a service (Remoting or ASMX) and call the service from
your 1.0 code.

Signature

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************

> Does anyone know what establishes the framework an assembly will run under?
> For example, when I look at my custom assembly (C# library) in the GAC, the
[quoted text clipped - 22 lines]
>
> Steve
Steve Franks - 09 Jul 2005 11:47 GMT
Thanks.  I have some clarifications please.

For this discussion please assume the scenario where I use Visual Studio
2005 beta 2 to compile my assembly. This assembly does NOT use any code,
classes, interfaces, etc that are specific to framework 2.0.  In other
words, this same exact code would compile just fine under say the original
VS.NET 1.0.  The only difference is that I am compiling it with VS 2005.  As
I understand it, at this point the GAC will list it as version 2.x.x.x.

1) Are you saying that if I gave this assembly to someone to use on a
machine that did not have the 2.0 framework installed, that it would not run
without a special wrapper or doing something tricky?  What would happen
exactly - an error message?

2) Is there an option within Visual Studio where you tell it what version of
the framework you are targetting?  In other words, I'd like 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 ok, and warn me if at
any time I use a class or other function that is not available under my
target framework.

Thanks,

Steve

> The GAC determines framework by which compiler was used. If you use the
> 1.0
[quoted text clipped - 50 lines]
>>
>> Steve

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.