No, the executable would not include all code from System.Data.SQLClient
. Instead the .NET runtime loads the assemblies your app references. That allows assemblies to be shared among many apps. So the running process includes the code from System.Data.dll
, but your executable does not.
Question
In VB.NET you can add file references or project references. For example, if you wanted to use the SQLConnection class, then you would add a reference to System.Data.SQLClient and import the namespace.
How does this work at a lower level in MSIL and assembly language. I assume that the executable would contain all the code from System.Data.SQLClient?
I have inspected some MSIL generated from a VB.NET project, but I am still unclear.
Solution
OTHER TIPS
The system.Data assembly is loaded (because your project reference it), you can see this in the MANIFEST (ildasm)
.assembly extern System.Data
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
.ver 4:0:0:0
}
Call that uses SqlConnection:
IL_000f: newobj instance void [System.Data]System.Data.SqlClient.SqlConnection::.ctor()
Defnition of .assembly extern:
.assembly extern <assembly name>
Specifies another assembly that contains items referenced by the current module (in this example, mscorlib).
More information: http://msdn.microsoft.com/en-us/library/ceats605.aspx
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow