Multiple versions of framework at the same time

  • Thread starter Massimiliano Alberti
  • Start date
M

Massimiliano Alberti

What happens if I write a .net program using the framework 3.5 and I use a
2.0 dll? Are both frameworks (3.5 and 2.0) loaded at the same time "eating"
more memory, or does the 2.0 dll uses the 3.5 framework?

--- thanks
 
J

Jon Skeet [C# MVP]

Massimiliano Alberti said:
What happens if I write a .net program using the framework 3.5 and I use a
2.0 dll? Are both frameworks (3.5 and 2.0) loaded at the same time "eating"
more memory, or does the 2.0 dll uses the 3.5 framework?

There isn't really any such thing as a "2.0 dll" vs a "3.5 dll".
There's just assemblies which use the 2.0 runtime, and which either
refer to assemblies from 3.5 or not.
 
C

Cowboy \(Gregory A. Beamer\)

3.5 is set on top of 2.0, so it is not loading entire frameworks 2.0 and
3.5. Furthermore, the framework is sliced up into different assemblies,
which are divided into classes. Portions of this framework are ngened, while
other portions are not.

What this means to you is the only thing loaded is that which you are using,
so don't sweat it.

As far as memory, .NET "eats" a lot of memory anyway. This sounds bad, but
it is really rather efficient overall, as it only garbage collects when it
needs memory. On your machine, you will see this as a growing footprint
until it reaches a certain size. Most of the "used" memory is actually ready
to be collected, but .NET waits until it is needed. "Used" memory that is
not actively being much like "unused" memory, except it needs to be marked
so the rest of the system can take advantage of it.

Hope this helps. Probably a bit too meandering.

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

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

*************************************************
| Think outside the box!
|
*************************************************
 
M

Massimiliano Alberti

Aaaaand so, in simple terms? If I make a Class Library with visual studio
2008 targetting .Net 2.0 and an app targetting .Net 3.5 that uses the Class
Library I created before, the class library will run under .Net 2.0 or 3.0?
How many frameworks will I have in memory? 1 or 2? Is it the same if I use a
1.1 Class library?

--- bye
 
J

Jon Skeet [C# MVP]

Massimiliano Alberti said:
Aaaaand so, in simple terms? If I make a Class Library with visual studio
2008 targetting .Net 2.0 and an app targetting .Net 3.5 that uses the Class
Library I created before, the class library will run under .Net 2.0 or 3.0?
How many frameworks will I have in memory? 1 or 2?

One. A process only ever runs one runtime, and the same runtime is used
for both .NET 2.0 and .NET 3.5 - it's just that there are more
assemblies in .NET 3.5.
Is it the same if I use a 1.1 Class library?

1.1 has a different CLR - you can't load a CLR-2.0 assembly in the 1.1
CLR. However, you can easily run a CLR-1.1 assembly in a 2.0 CLR, and
you won't get it loading up another framework at the same time.
 
S

Steven Cheng

Hi Massimiliano,

The answer is yes, you can. Actually, .net framework 3.0 and 3.5 is are not
completely stand alone from .NET 2.0. They're all built upon .net framework
2.0(3.0 AND 3.5 rely on most of the .NET framework 2.0 system assemblies).
Therefore, you can use .NET framework 2.0 built assemblies in .NET 3.0 or
..NET 3.5 equipted application without any problems.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 

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