- •Table of Contents
- •C# and the .NET Platform, Second Edition
- •Introduction
- •Part One: Introducing C# and the .NET Platform
- •Part Two: The C# Programming Language
- •Part Three: Programming with .NET Assemblies
- •Part Four: Leveraging the .NET Libraries
- •Part Five: Web Applications and XML Web Services
- •Obtaining This Book's Source Code
- •The .NET Solution
- •What C# Brings to the Table
- •The Role of the Assembly Manifest
- •Summary
- •Chapter 2: Building C# Applications
- •Summary
- •Chapter 3: C# Language Fundamentals
- •Defining Program Constants
- •Defining Custom Class Methods
- •C# Enumerations
- •Summary
- •The Second Pillar: C#'s Inheritance Support
- •Summary
- •Catching Exceptions
- •Finalizing a Type
- •Garbage Collection Optimizations
- •Summary
- •Chapter 6: Interfaces and Collections
- •Building Comparable Objects (IComparable)
- •Summary
- •Summary
- •Internal Representation of Type Indexers
- •Summary
- •An Overview of .NET Assemblies
- •Understanding Delayed Signing
- •Using a Shared Assembly
- •GAC Internals
- •Summary
- •Spawning Secondary Threads
- •A More Elaborate Threading Example
- •Summary
- •Summary
- •Object Persistence in the .NET Framework
- •The .NET Remoting Namespaces
- •Understanding the .NET Remoting Framework
- •All Together Now!
- •Terms of the .NET Remoting Trade
- •Testing the Remoting Application
- •Revisiting the Activation Mode of WKO Types
- •Deploying the Server to a Remote Machine
- •Summary
- •Control Events
- •The Form Class
- •Summary
- •Regarding the Disposal of System.Drawing Types
- •Understanding the Graphics Class
- •Summary
- •The TextBox Control
- •Working with Panel Controls
- •Configuring a Control's Anchoring Behavior
- •Summary
- •Chapter 16: The System.IO Namespace
- •The Static Members of the Directory Class
- •The Abstract Stream Class
- •Summary
- •The Role of ADO.NET Data Providers
- •The Types of System.Data
- •Selecting a Data Provider
- •The Types of the System.Data.OleDb Namespace
- •Working with the OleDbDataReader
- •Summary
- •Submitting the Form Data (GET and POST)
- •Some Benefits of ASP.NET
- •Creating an ASP.NET Web Application by Hand
- •The Composition of an ASP.NET Page
- •The Derivation of an ASP.NET Page
GAC InternalsC# and the .NET Platform, Second Edition
by Andrew Troelsen |
ISBN:1590590554 |
Now that you understand the overall role of the GAC, let's dig into its internal composition. When you view
Apress © 2003 (1200 pages)
the GAC using the Windows Explorer, you find a number of icons displayed within a comfortable GUI shell.
This comprehensive text starts with a brief overview of the
This GUI shell is C#providedlanguagecourtesyand thenof aquicklyCOM servermov s namedto key technicalshfusionand.dll (if for some reason your machine's GAC isarchitecturnot displayingl issuesitselfforcorrectly,.NET developerssimply.run regsvr32.exe and provide shfusion.dll as its sole argument). To understand what the GAC really boils down to, open a command prompt and change to the following directory (where %windir% represents the name of your registered Window's directory and
Table of Contents
<drive> is, well, your drive):
C# and the .NET Platform, Second Edition
Introduction
<drive>:\%windir%\Assembly\GAC
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter 2 - Building C# Applications
PartOnceTwoyou- TheareC#in, Programmingissue "dir" commandLanguagefrom the command line. You will be presented with a list of a
Chapternumber3of-hiddenC# LanguagesubdirectoriesFundamentals(Figure 9-28).
Chapter 4 - Object-Oriented Programming with C#
Chapter
Chapter
Chapter
Chapter
Part
Chapter
Chapter
Chapter |
Based Programming |
Part
Chapter
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Figure 9-28: The hidden GAC subdirectory
Chapter 14 - A Better Painting Framework (GDI+)
ChapterNow, using15 - thePrograsamemingcommandwith Windprompt,ws FormschangeControlsto the \SharedAssembly subdirectory and again issue a
Chapter"dir" command16 - The(SystemFigure.9IO-29Namespace).
Chapter 17 - Data Access with ADO.NET
Part
Chapter
Chapter
Chapter
Index
List of
List of
Figure 9-29: Inside the hidden \SharedAssembly subdirectory
As you can see, the GAC has created a subdirectory for each version of the SharedAssembly.dll assembly, each of which is contained within a uniquely named folder: <versionOfAssembly>__PublicKeyToken. If you were again to change the current directory to version 1.0.0.0 of SharedAssembly, you would indeed find a copy of the original single file assembly you created a la VS .NET (Figure 9-30).
ISBN:1590590554
overview of the technical and
Table of Contents
Figure 9-30: Behold! The GAC's internal copy of sharedassembly.dll
C# and the .NET Platform, Second Edition
Introduction
PartAs youOnecan- I troducingsee, the GACC# andis atheshell.NETthatPlatformhides a number of subdirectories from view using various icons. ChapterThus, understand1 - The Philosophythat whenofyou.NETdeploy strongly named assemblies to the GAC, the OS responds by
creating a specific subdirectory behind the scenes. This is how the runtime is able to store multiple copies
Chapter 2 - Building C# Applications
of a particular .NET assembly (while avoiding name-clashes).
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
Chapter 4 - Object-Oriented Programming with C#
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
Chapter 7 - Callback Interfaces, Delegates, and Events
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables
Assembly-Centric# and theOdds.NET Platform,and EndsSecond Edition
by Andrew Troelsen |
ISBN:1590590554 |
At this point, you hopefully have a solid understanding of the distinction between a private and shared assembly
Apress © 2003 (1200 pages)
well as an understanding of a number of ways to leverage configuration files to declaratively control how the CL
This comprehensive text starts with a brief overview of the
loads an externalC#referencelanguage. Toandwrapthenupquicklythis chapter,moves toI'dkeyliketechnicalto examineanda set of unrelated (but very important) assembly-centricarchitecturaltopics that youissuesareforsure.NETto finddevelopersuseful.
Specifying <codeBase> Elements
Table of Contents
C# and the .NET Platform, Second Edition
Another aspect of application configuration files is the use of code bases. A given *.config file can support anoth
Introduction
XML element named <codeBase>, which is used by the assembly resolver to locate dependent assemblies loc
Part One - Introducing C# and the .NET Platform
at arbitrary locations (including other machines). Understand, however, that if you wish to make use of <codeBa
Chapter 1 - The Philosophy of .NET
to direct the runtime to look in a folder outside of the client's application directory, the referenced assembly sho
Chapter 2 - Building C# Applications be equipped with a strong name.
Part Two - The C# Programming Language
ChapterNote3 While- C# Language<codeBase>Fundamentalscan be used to probe for assemblies that do not have a strong name, the assemb
location must be relative to the client's application's directory (and thus is little more than an alternativ
Chapter 4 - Object-Oriented Programming with C#
the <privatePath> element).
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
To illustrate, create a new Console application (CodeBaseAsmUser) that makes use of the SharedAssembly.dl
Chapter 7 - Callback Interfaces, Delegates, and Events
(version 2.0.0.0):
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
using System;
Chapter 9 - Understanding .NET Assemblies using SharedAssembly;
Chapter 10 - Processes, AppDomains, Contexts, and Threads namespace CodeBaseAsmUser
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
{
Part Four - Leveraging the .NET Libraries
class CodeBaseUser
Chapter 12 - Object Serialization and the .NET Remoting Layer
{
Chapter 13 - Building a Better Window (Introducing Windows Forms)
static void Main(string[] args)
Chapter 14 - A Better Painting Framework (GDI+)
{
Chapter 15 - Programming with Windows Forms Controls
VWMiniVan v = new VWMiniVan();
Chapter 16 - The System.IO Namespace
v.CrankGoodTunes(BandName.deftones);
Chapter 17 - Data} Access with ADO.NET
Part Five}- Web Applications and XML Web Services
Chapter} 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Given that sharedassembly.dll is located in the GAC, you are able to run the program "as-is." To illustrate the u
Index
<codeBase>, create a new folder under your C drive (perhaps C:\MyAsms) and place a copy of SharedAssemb 2.0.0.0 under the new directory. Next, create a configuration file (CodeBaseAsmUser.exe.config) that will force assembly resolver to probe under C:\MyAsms as it attempts to locate each referenced assembly:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="SharedAssembly" publicKeyToken="82fbc820d160f2b8
<codeBase version="2.0.0.0" href="file:///C:\MyAsms\SharedAssembly.dll"
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
As you can see, the <codeBase> element is nested within the <dependentAssembly> element, and specifies th version and location (via the "href" property) of the .NET binary. If you were now to delete version 2.0.0.0 of
SharedAssembly.dll from the GAC, your client application would still run, as the assembly resolver was able to
C# and the .NET Platform, Second Edition
locate the dependent binary under your custom directory. Also, if you were now to delete the MyAsms folder fro
by Andrew Troelsen ISBN:1590590554
your machine, the client would fail. As you may have been able to gather, <codeBase> elements (if present) ta
Apress © 2003 (1200 pages)
precedent over the investigation of the GAC.
This comprehensive text starts with a brief overview of the
Let me offer a wordC# oflanguagecautionandregardingthen quicklythis particularmoves toaspectkey technicalof applicationand configuration files. When you place
architectural issues for .NET developers.
custom assemblies at random locations on your development machine, you are in effect re-creating DLL hell, g that if you move or rename the folder containing your binaries, the current bind will fail.
Table of Contents
As mentioned however, <codeBase> can be helpful when you are attempting to reference assemblies (single f C#multifile)and thelocated.NET Platform,on someSecondotherEditionnetworked machine. For the sake of illustration, assume you have permission t Introductionaccess a folder located at www.intertech-inc.com. You could update your <codeBase> element as follow
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
<codeBase version="2.0.0.0"
Chapter 2 - Building C# Applications
href="http://www.Intertech-inc.com/MyAsms/SharedAssembly.dll" />
Part Two - The C# Programming Language
Chapter 3 - C# Language Fundamentals
In this case, you still have the possibility of breaking the client application. The bottom line is that <codeBase>
Chapter 4 - Object-Oriented Programming with C#
elements should be used with care.
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
SOURCE The CodeBaseAsmUser application can be found under the Chapter 9 subdirectory.
Chapter 7 - Callback Interfaces, Delegates, and Events
CODE
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
Working with Publisher Policy Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
The next configuration issue we examine is the use of publisher policy assemblies. As you have already seen,
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
*.config files can be used by private assemblies to instruct the runtime to probe under various subdirectories wh
Part Four - Leveraging the .NET Libraries
resolving the location of a given assembly. Shared assemblies can also make use of *.config files to dynamical
Chapter 12 - Object Serialization and the .NET Remoting Layer
bind to an assembly other than the version recorded in the client manifest. Do note that both of these approach
Chapter 13 - Building a Better Window (Introducing Windows Forms)
require that somebody (such as a system administrator) is required to create and edit a *.config file on each clie
Chapter 14 - A Better Painting Framework (GDI+) machine.
Chapter 15 - Programming with Windows Forms Controls
Publisher policy allows the publisher of a given assembly (you, your department, your company, or what have y
Chapter 16 - The System.IO Namespace
to ship a special binary version of a *.config file that is installed into the GAC along with the assembly it is
Chapter 17 - Data Access with ADO.NET
responsible for influencing. When this information is placed into the GAC, the client's application directory does
Part Five - Web Applications and XML Web Services
need to contain a specific *.config file. Given this, the redirecting of shared assemblies is less of a burden on th
Chapter 18 - ASP.NET Web Pages and Web Controls
individual responsible for configuring individual .NET clients. All he or she needs to do is install the new binary
Chapter 19 - ASP.NET Web Applications
*.config file shipped by the publisher into the GAC and walk away.
Chapter 20 - XML Web Services
Index
Given that the GAC can only store .NET *.dlls, the *.config file itself is not installed into the GAC. Rather, the
List of Figures
publisher is responsible for creating a *.dll file based on the *.config (or *.xml) file using the command line tool,
List of Tables
al.exe (assembly linker). Do note that VS .NET does not support the construction of publisher policy binaries.
The good news is that the syntax of a *.xml publisher policy configuration file is identical to that of an application specific *.config file. Assume you wish to build a publisher policy assembly based on the XML contained in the previous SharedAsmUser.exe.config file. The command set is as follows:
al /link:SharedAssemblyUser.xml /out:policy.1.0.SharedAssembly.dll
/keyf:C:\MyKey\myKey.snk /v:1.0.0.0
As you can see, you do need to specify the input file containing the XML, the name of the output file (which mus in the format "policy.<major>.<minor>.assemblyToConfigure"), and the name of the file containing the public/p key pair (remember! Publisher policy files are shared, and therefore must have a strong name!). Once the al.e tool has executed, the result is a new assembly that can be placed into the GAC to force all clients to bind to ve 2.0.0.0 of the SharedAssembly.dll, without the use of a specific client application configure file (Figure 9-31).
ISBN:1590590554
of the
and
Table
C# andFigurethe .NET9-31:PlatfoOurm,publisherSecond policyEditionassembly
Introduction
Part One - Introducing C# and the .NET Platform
ChapterDisabling1 - ThePublisherhilosophy of .NETPolicy
Chapter 2 - Building C# Applications
PartIt isTwopossible- ThetoC#buildProgramminga client configurationLangu ge file that instructs the CLR to ignore the presence of any publisher pol
files installed in the GAC. This may be helpful if a system administrator determines that a particular client
Chapter 3 - C# Language Fundamentals
executable is (somehow) broken when rebinding to the new version of the shared binary. To disable publisher p
Chapter 4 - Object-Oriented Programming with C#
on a client-by-client basis, simply build a (properly named) *.config file with the following XML:
Chapter 5 - Exceptions and Object Lifetime
Chapter 6 - Interfaces and Collections
<configuration>
Chapter 7 - Callback Interfaces, Delegates, and Events
<runtime>
Chapter 8 - Advanced C# Type Construction Techniques
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Part Three - Programming with .NET Assemblies
<publisherPolicy apply="no" />
Chapter 9 - Understanding .NET Assemblies
</assemblyBinding>
Chapter 10 - Processes, AppDomains, Contexts, and Threads
</runtime>
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
</configuration>
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
Once this is done, the CLR will load the version of the assembly originally listed in the client's manifest.
Chapter 14 - A Better Painting Framework (GDI+)
Chapter 15 - Programming with Windows Forms Controls
The Machine-wide Configuration File
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
The configuration files you have been examining in this chapter each have a common theme. They only apply t
Part Five - Web Applications and XML Web Services
specific application (that is why they had the same name as the launching application). In addition, each .NET-
Chapter 18 - ASP.NET Web Pages and Web Controls
aware machine has a file named "machine.config" that contains listings used to override any application-specifi
Chapter 19 - ASP.NET Web Applications
configuration files (as you might guess, reading this file is a great way to learn more *.config-centric tags).
Chapter 20 - XML Web Services
Practically speaking, if you wish to automatically redirect the binding policy for all clients that make use of a give
Index
assembly, altering the machine.config file provides an easy alternative to distributing numerous application-spe
List of Figures
*.config files to each application directory.
List of Tables
Although this file can be directly edited using notepad.exe, be very aware that if you were to alter this file incorre you may cripple the ability of the runtime to function correctly. This scenario can be far more painful than a malformed application *.config file, given that bad XML in an application configuration file only affects a single application. On the other hand, bad XML in the machine.config file can entail reformatting your development machine.
The System.Configuration Namespace
It should come as no surprise that the .NET Framework provides a namespace that allows you to programmati interact with *.config files. The System.Configuration namespace (defined within the System.dll assembly) provi a small set of types you may use to read data from a client's <appSettings> section of a configuration file.
Specifically, the AppSettingsReader type will allow you to pull out values based on a string key token. For exam assume we have a *.config file for a Console application named AppConfigReaderApp, which maintains an ADO.NET connection string and a point of data named "timesToSayHello":
<configuration>
C# and the .NET Platform, Second Edition
<appSettings>
by Andrew Troelsen ISBN:1590590554
<add key="appConStr" value="server=localhost;uid=sa;pwd=;database=Cars"
Apress © 2003 (1200 pages)
<add key="timesToSayHello" value="8" />
This comprehensive text starts with a brief overview of the
</appSettings>
C# language and then quickly moves to key technical and
</configuration>
architectural issues for .NET developers.
To read these values for use by the client application is as simple as calling the instance level GetValue() meth
Table of Contents
the AppSettingsReader type:
C# and the .NET Platform, Second Edition
Introduction
class TheReader
Part One - Introducing C# and the .NET Platform
{
Chapter 1 - The Philosophy of .NET
static void Main(string[] args)
Chapter 2 - Building C# Applications
{
Part Two - The C# Programming Language
AppSettingsReader ar = new AppSettingsReader();
Chapter 3 - C# Language Fundamentals
Console.WriteLine(ar.GetValue("appConStr", typeof(string)));
Chapter 4 - Object-Oriented Programming with C#
int numbOfTimes = (int)ar.GetValue("timesToSayHello", typeof(int));
Chapter 5 - Exceptions and Object Lifetime
for(int i = 0; i < numbOfTimes; i++)
Chapter 6 - Interfaces and Collections
Console.WriteLine("Yo!");
Chapter 7 - Callback Interfaces, Delegates, and Events
}
Chapter 8 - Advanced C# Type Construction Techniques
}
Part Three - Programming with .NET Assemblies
Chapter 9 - Understanding .NET Assemblies
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
Part FourSOURCE- LeveragingThet .AppConfigReaderAppNET Libraries application can be found under the Chapter 9 subdirectory.
ChapterCODE12 - Object Serialization and the .NET Remoting Layer
Chapter 13 - Building a Better Window (Introducing Windows Forms)
ChapterUsing14 the- A Better.NETPaintingAdministrativeFramework (GDI+) Tool
Chapter 15 - Programming with Windows Forms Controls
ChapterThis chapter16 - Thase Systemillustrated.IO Namespacehow to create an XML application configuration file by hand. While seeing what hap
under the hood is edifying, the process of crafting raw XML files is a bit on the verbose side and a rather error-p
Chapter 17 - Data Access with ADO.NET
endeavor. Given this, the .NET SDK ships with a tool named mscorcfg.msc (yet another MS snap-in utility) that
Part Five - Web Applications and XML Web Services
generate the correct XML automatically, based on your design-time configurations. To illustrate, open up the .N
Chapter 18 - ASP.NET Web Pages and Web Controls
admin tool (which by default is located under <drive>:\%windir%\Microsoft.NET\Framework\<version>) and che
Chapter 19 - ASP.NET Web Applications
out the initial GUI (see Figure 9-32).
Chapter 20 - XML Web Services Index
List of
List of
Figure 9-32: The .NET administration utility
As you can see, this tool has numerous options. While I'll assume you will check things out at your leisure, I wo like to point out the use of the Applications node. By right-clicking this item, you are able to specify the name of client application you wish to configure (as seen in the previous figure). Once you have added a client applicatio two), you may select the Configured Assemblies node and activate the Configure an Assembly link. Once you p
the dependent assembly you wish to configure, you are able to specify binding policies for the client application
C# and the .NET Platform, Second Edition
(Figure 9-33). Once you hit OK, the underlying *.config file will be automatically generated.
by Andrew Troelsen
Apress © 2003 (1200 pages)
ISBN:1590590554
with a brief overview of the moves to key technical and
developers.
Table
C# and
Part
Chapter
Chapter
Part
Chapter
Chapter |
C# |
Chapter
Chapter
ChapterFigure7 - 9Callback-33: DeclarativelyInterfac s, buildingDelegates,*and.configEventsfile
Chapter 8 - Advanced C# Type Construction Techniques
Part Three - Programming with .NET Assemblies
If you wish to alter aspects of the machine.config file, simply make use of the options seen in the right-hand pan
Chapter 9 - Understanding .NET Assemblies
when you select the Configured Assemblies icon of the left tree-view.
Chapter 10 - Processes, AppDomains, Contexts, and Threads
Chapter 11 - Type Reflection, Late Binding, and Attribute-Based Programming
The Ngen.exe Utility
Part Four - Leveraging the .NET Libraries
Chapter 12 - Object Serialization and the .NET Remoting Layer
The .NET SDK ships with an assembly-centric command line utility named ngen.exe. The role of ngen.exe is to
Chapter 13 - Building a Better Window (Introducing Windows Forms)
compile CIL instructions to platform-specific code during the installation process, rather than an as needed bas
Chapter 14 - A Better Painting Framework (GDI+)
(which is the default behavior).
Chapter 15 - Programming with Windows Forms Controls
ChaptWhilerexamining16 - The Systemthe contents.IO Namespaceof your machine's GAC, you may have noticed that some of the shared assembli Chavepterbeen17 -markedD ta Accesswith thewith"NativeADO.NETImage" designation. When a shared assembly has been configured as Part"prejitted,"Five - WebtheApplicationsresult is an assemblyand XML Webthat Servicescan be loaded faster by the assembly resolver. Notice that I did not sa
code within the assembly will necessarily execute any faster. The truth of the matter is, prejitted code is not
Chapter 18 - ASP.NET Web Pages and Web Controls
guaranteed to run any faster than standard just-in-time compiled code, given that the CLR is still required to ac
Chapter 19 - ASP.NET Web Applications
the metadata found in the non-prejitted assembly in addition to the native instructions contained in the native im
Chapter 20 - XML Web Services
Index
Given this, pre-Jitting CIL code is advantageous when you have an assembly that you suspect will be used by a
List of Figures
great many applications on a given machine (or at least when you suspect the types within this assembly will be
List of Tables
used frequently). Reason? Faster load times.
If you determine (through code profiling or an educated guess) that a particular assembly may benefit from the process, you need to make use of the ngen.exe utility that ships with the .NET SDK, located (by default) under C:\WINNT\Microsoft.NET\Framework\<version> (your version may differ). Ngen.exe requires you to specify the friendly name of the assembly to register. If the binary is in the GAC, there is no need to supply a literal path to binary, as ngen.exe makes use of the same probing process as outlined during the course of this chapter. Thus
ngen SomeAssembly
Like any of the tools that ship with the .NET SDK, ngen.exe has numerous options, so check out online Help for further details (simply search for ngen.exe using MSDN).
Regarding C#theandVSthe.NET. T Platform,Add ReferencesS cond Edition Dialog Box
by Andrew Troelsen |
ISBN:1590590554 |
Finally, let's revisit the VS .NET Add Reference dialog box. Recall that the list of assemblies seen from the
Apress © 2003 (1200 pages)
.NET tab does not represent each and every assembly on your machine and does not directly map to the
This comprehensive text starts with a brief overview of the
items within the GACC# language. This listandis nothingthen quicklymoremovesthan atosetkeyof suggestionstechnical and. Although you are always free to simply use the Browsearchitecturalbuttonissuesto navigatefor .NETto thedeveloperslocation. of an external .NET assembly, it is possible to configure your custom .NET assemblies to appear within the suggested list presented by VS .NET.
TableWhenofyouContentsinstall VS .NET 2003 a directory will be created named PublicAssemblies, located by default C#underand C:\Programthe .NET Platform,Files\MicrosoftSecond EditionVisual Studio .NET 2003\Common7\IDE. If you place a copy of your
custom assembly within the PublicAssemblies folder, lo and behold, your *.dll will be listed automatically
Introduction
(Figure 9-34).
Part One - Introducing C# and the .NET Platform
Chapter 1 - The Philosophy of .NET
Chapter
Part
Chapter
Chapter
Chapter
Chapter
Chapter
Chapter
Part
Chapter |
|
Chapter |
|
Chapter |
Programming |
Part |
|
Chapter |
|
Chapter |
Forms) |
Chapter
Figure 9-34: Suggesting CarLibrary.dll to VS .NET developers
Chapter 15 - Programming with Windows Forms Controls
Chapter 16 - The System.IO Namespace
Chapter 17 - Data Access with ADO.NET
Part Five - Web Applications and XML Web Services
Chapter 18 - ASP.NET Web Pages and Web Controls
Chapter 19 - ASP.NET Web Applications
Chapter 20 - XML Web Services
Index
List of Figures
List of Tables