hf

导航

 

.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) :

  1. Working directory .
  2. The directory that contains the CSC .exe file itself .
  3. Any directories specified using the /lib compiler switch .
  4. 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.

  1. Common Definition Metadata Tables
  2. Common Reference Metadata Tables
  3. 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 .

  1. An assembly defines the reusable types .
  2. An assembly is marked with a version number .
  3. An assembly can have security information associated with it .

Three reasons to use multifile assemblies:

  1. You can partition your types among separate files, allowing for files to be incrementally downloaded as described in the Internet download scenario .
  2. You can add resource or data files to your assembly .
  3. 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

image

  • 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):

  1. AppDir\AsmName.dll 
  2. AppDir\AsmName\AsmName.dll 
  3. AppDir\firstPrivatePath\AsmName.dll 
  4. AppDir\firstPrivatePath\AsmName\AsmName.dll 
  5. AppDir\secondPrivatePath\AsmName.dll 
  6. AppDir\secondPrivatePath\AsmName\AsmName.dll 
  7. ...
posted on 2010-06-28 19:59  hf  阅读(199)  评论(0)    收藏  举报