nnakhlis

Hi,

Please help me on how to include library file into my C# poject. I need to use CXimage.lib wiht my project to convert images.

Thank you



Re: Visual C# IDE Importing library

OmegaMan

If they have not registered it in the GAC, then you can browse to it. Here is the steps in VS2005
  1. Highlight the project in Solutions Explorer which needs the reference.
  2. Right click on the references folder and choose Add Reference.
  3. If the library it has been registered in the GAC, you can find it in the .Net tab.
  4. If it is a COM dll, then look in the COM tab (unlikely).
  5. If it has not found by 3 or 4, then select browse and find the dll on the hard drive.
VS 2003 is similar, its just the browse is on the .Net page.





Re: Visual C# IDE Importing library

Chris Dunaway

OmegaMan wrote:

  1. If the library it has been registered in the GAC, you can find it in the .Net tab.


This is wrong. What is displayed in the .Net tab of the references dialog has nothing to do with the GAC.

From the docs:


The Add Reference dialog box only lists assemblies in the Public Assemblies folder (Program Files\Microsoft Visual Studio .NET\Common7\IDE\Public Assemblies). You can copy your own assemblies to the Public Assemblies folder, or browse to them directly. Note that you cannot add references from the Global Assembly Cache (GAC), as it is strictly part of the run-time environment.




Here is the link:

http://msdn2.microsoft.com/en-us/library/wkze6zky(VS.80).aspx

Chris





Re: Visual C# IDE Importing library

OmegaMan

Chris Dunaway wrote:
OmegaMan wrote:

  1. If the library it has been registered in the GAC, you can find it in the .Net tab.


This is wrong. What is displayed in the .Net tab of the references dialog has nothing to do with the GAC.

From the docs:


The Add Reference dialog box only lists assemblies in the Public Assemblies folder (Program Files\Microsoft Visual Studio .NET\Common7\IDE\Public Assemblies). You can copy your own assemblies to the Public Assemblies folder, or browse to them directly. Note that you cannot add references from the Global Assembly Cache (GAC), as it is strictly part of the run-time environment



That is quite true, but falls short for that blurb you quote it is in the section Adding References at Design Time and if you scroll down to References to Shared Components at Run Time it then says

At run time, components must be either in the output path of the project or in the Global Assembly Cache (GAC). If the project contains a reference to an object that is not in one of these locations, you must copy the reference to the output path of the project when you build the project. The CopyLocal property indicates whether this copy needs to be made. If the value is True, the reference is copied to the project directory when you build the project. If False, the reference is not copied. If you deploy an application that contains a reference to a custom component that is registered in the GAC, the component will not be deployed with the application, regardless of the CopyLocal setting. In previous versions of Visual Studio, you could set the CopyLocal property on a reference to ensure that the assembly was deployed. Now, you must manually add the assembly to the \Bin folder. This puts all custom code under scrutiny, reducing the risk of publishing custom code with which you are not familiar.

To quote the information about the Public assemblies (found in the readme file in the directory)

The PublicAssemblies folder is designed to contain managed assemblies that run within the development environment
and are typically called from macros, add-ins, and other user code. The assemblies in this directory are displayed in the
Project Add References dialog box and the Object Browser's Component Selector dialog box. For example, COM
interoperability wrappers for automation object models (e.g. vslangproj.dll) should be installed in the PublicAssemblies folder.




Re: Visual C# IDE Importing library

Chris Dunaway

OmegaMan wrote:

The .Net tab does show registered items from the GAC as well as design time components, which may be a better way of looking at it than just saying GAC.


The point that I was trying to make was that simply registering an assembly in the GAC will not make it appear in the .Net tab of the references dialog.