Microsoft 9GD00001 Computer Accessories User Manual


 
124 Microsoft Visual Studio 2010: A Beginner’s Guide
(GAC), which is a shared repository of assemblies. Microsoft and third parties will place
assemblies in the GAC to make it easier to share them by any programs.
The COM tab shows all of the COM applications currently registered on your
computer. For example, if you wanted to communicate with Excel, you would click
the COM tab and add a reference to the version of Microsoft Office Excel that you are
working with. Adding a reference to a COM object causes VS to automatically generate
a new assembly, called an Interop assembly, that has stub methods that make it easy
for you to perform operations on that COM object. You would need to reference the
documentation for the COM object/application to determine what operations are possible,
but this is a very powerful way to work with legacy applications and Microsoft Office
applications that expose a COM interface.
CAUTION
If you’re adding an assembly reference for a VB project, remember to open My
Projects on ProjectDemo, go to the Compile tab, click the Advanced Compile Options
button, and ensure that the Target Framework is set to .NET Framework 4.0 (not
.NET Framework 4.0 Client Profile). The reason is that the class library project is
automatically set to .NET Framework 4.0 and the target framework for both the
referencing and referenced assemblies must be the same.
The Recent tab has a list of references that you’ve recently added to a project, which
is a convenience based on the probability that if you added a reference to one project
in a solution, you might want to quickly add that same reference to others. The Browse
tab of the Add Reference window allows you to search the file system for a *.dll file to
add as a reference. Just remember that if you are referencing a *.dll for a project in the
same solution, it would be better to use the Project tab, which manages dependencies and
ensures that your project is updated if the referenced project changes. File references can’t
know if the external *.dll changed because the external *.dll is outside of your solution.
In most cases, if you’re referencing an external *.dll, you don’t have the code, so a project
reference won’t be possible. The next section explains more about project references.
NOTE
The New Projects window, CTRL-N, contains Office project types that can help you get
started building Microsoft Office applications.
Managing Assembly References
Occasionally, you might want to remove an assembly reference because it isn’t necessary
or because you accidentally added the wrong reference. In C#, you would open the
References folder, select the reference to remove, and press
DELETE. In VB, you would