B
Brett
If I believe certain project references (VS.NET) aren't being used, how can
this be confirmed?
Thanks,
Brett
this be confirmed?
Thanks,
Brett
Brett said:If I believe certain project references (VS.NET) aren't being used, how
can this be confirmed?
James Curran said:Remove them, one at a time, and recompile. If you get an error, put it
back. If not, move on to the next.
--
--
Truth,
James Curran
[erstwhile VC++ MVP]
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
Brett said:If I believe certain project references (VS.NET) aren't being used, how can
this be confirmed?
Thanks,
Brett
Brett said:Will removing the unused reference shrink the overall assembly size?
VS.NET will add certain references I don't always need - system.data,
system.xml. Are there any cases these should remain if I know they will
not be used?
I was hoping there was a more efficient way.
Will removing the unused reference shrink the overall assembly size?
No
VS.NET will add certain references I don't always need - system.data,
system.xml. Are there any cases these should remain if I know they will not
be used?
Not much if any size difference, but it will load a little faster since the
system doesn't need to locate and open the referenced assemblies.
Bruce Wood said:Do you mean that the C# compiler isn't smart enough not to insert code
to load assemblies that aren't used by the code? I would have thought
that either the compiler / CLR would load assemblies on "first use", so
if you don't call them, they don't get loaded, or at least not build in
code to load assemblies that aren't used in the code.
Bruce Wood said:Do you mean that the C# compiler isn't smart enough not to insert code
to load assemblies that aren't used by the code? I would have thought
that either the compiler / CLR would load assemblies on "first use", so
if you don't call them, they don't get loaded, or at least not build in
code to load assemblies that aren't used in the code.
The "first use" method would seem the most efficient: what if your
program uses some large assembly but the user never takes an action
that would cause it to be called? Would the CLR load it when your app
starts up, anyway, even if the user never did anything that would
require that assembly? Now I'm curious.![]()
Bruce Wood said:When are the assemblies loaded? When the application starts up, or upon
first call?
This may make a difference, for example, in an application that
produces reports and can produce graphs. The graphing assembly might be
some monster beast that can produce pie charts, bar charts, line
graphs, etc. If the user never requests a graph, does the assembly get
loaded anyway (since it is referenced by the main program assembly)? Or
does the CLR wait until the first attempt to call something in the
assembly before it loads it? I would hope the latter.
Willy Denoyette said:You are right.
Only assemblies that are 'referenced' in code (have entries in the
assembly's Metadata) can be loaded implicitely. Assemblies that are
included in your project settings (used by the compiler) but aren't
referenced in code are simply ignored by the compiler, they aren't
included in the Metadata and cannot be loaded implicitely.
Brett said:Willy, where did you find this information? That's pretty good. I
haven't read anything about that. Appreciate any references you can
provide.
Thanks,
Brett
Had to use the Amazon.uk site for this one.Willy Denoyette said:1.. Applied Microsoft .NET Framework Programming - J. Richter
2.. Shared Source CLI Essentials - Stutz, Neward and Shilling
3.. Essential .NET: Volume 1 - Don Box
4.. Inside Microsof .NET IL Assembler - S Lidin
Good stuff on the blogs.5.. The Common Language Infrastructure Annotated Reference - J.Miller, AW
6.. Compiling for the .NET Common Language Runtime (CLR) - Gough
7.. ECMA CLI Partition Specs http://msdn.microsoft.com/net/ecma/
8.. MSDN, MSDN Magazine, Microsoft CLR Team Blogs
http://blogs.msdn.com/default.aspx, Debugging experiences etc...
Here's a couple more that have good ratings and seem worthwhile:Willy.