.NET Framework Deployment goals
Goals:
- DLL hell .
- installation complexities .
- security.
As you’ll see, the .NET Framework enables users to control what gets installed and what runs, and in general, to control their machines, more than Windows ever did .
Building Types into a Module
csc.exe .the C# compiler automatically references the MSCorLib .dll assembly . /nostdlib switch
Response Files
A response file is a text file that contains a set of compiler commandline switches for CSC .exe .The C# compiler supports multiple response files . A default global CSC .rsp file in the %SystemRoot%\Microsoft .NET\Framework\vX.X.X directory.
Referencing all of these assemblies could slow the compiler down a bit . But if your source code doesn’t refer to a type or member defined by any of these assemblies, there is no impact to the resulting assembly file, nor to run-time execution performance .
If a complete path of referenced assembly is not specified the compiler will search for the file in the following places (in the order listed) :
- Working directory .
- The directory that contains the CSC .exe file itself .
- Any directories specified using the /lib compiler switch .
- Any directories specified using the LIB environment variable .
Ignore both local and global CSC .rsp files by specifying the /noconfig command-line switch .
A Brief Look at Metadata
ILDasm .exe to examine the metadata.
- Common Definition Metadata Tables
- Common Reference Metadata Tables
- Manifest metadata tables
Combining Modules to Form an Assembly
The CLR always loads the file that contains the manifest metadata tables first and then uses the manifest to get the names of the other files that are in the assembly .
- An assembly defines the reusable types .
- An assembly is marked with a version number .
- An assembly can have security information associated with it .
Three reasons to use multifile assemblies:
- You can partition your types among separate files, allowing for files to be incrementally downloaded as described in the Internet download scenario .
- You can add resource or data files to your assembly .
- You can create assemblies consisting of types implemented in different programming languages .
Adding Assemblies to a Project by Using the Visual Studio IDE
Using the Assembly Linker
Adding Resource Files to an Assembly
AL .exe
Assembly Version Resource Information
AssemblyInfo .cs file
Version Numbers
- AssemblyFileVersion: for information purposes only
- AssemblyInformationalVersion: for information purposes only
- AssemblyVersion:This number is extremely important and is used to uniquely identify an assembly .
Culture
Simple Application Deployment (Privately Deployed Assemblies)
Assemblies deployed to the same directory as the application are called privately deployed assemblies because the assembly files aren’t shared with any other application.The simple install/move/uninstall scenario is possible because each assembly has metadata indicating which referenced assembly should be loaded; no registry settings are required .
Simple Administrative Control (Configuration)
.config file
The order in which directories are probed for a culture-neutral assembly (where firstPrivatePath and secondPrivatePath are specified via the config file’s privatePath attribute):
- AppDir\AsmName.dll
- AppDir\AsmName\AsmName.dll
- AppDir\firstPrivatePath\AsmName.dll
- AppDir\firstPrivatePath\AsmName\AsmName.dll
- AppDir\secondPrivatePath\AsmName.dll
- AppDir\secondPrivatePath\AsmName\AsmName.dll
- ...
浙公网安备 33010602011771号