Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts
Saturday, May 5, 2012
Visual Studio 2008 Image library
The image library should be at "C:\Program Files\Microsoft Visual Studio 9.0\Common7\VS2008ImageLibrary\1033\VS2008ImageLibrary.zip" and in your installation process you must ensure that you check the option "Tools for redistributing Applications\Graphics Library" (See the attached image)
Friday, September 10, 2010
How to make VS 2008 to register a C# COM DLL
To make C# create and register the typelibrary go to
Project/Properties/Build tick Register for COM interop. (Reccomended Choice)
Otherwise you need to use REGASM (see here for the asembly registration tool). The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. This utility is necessary when you need to expose to COM e .exe (winform application) .net assembly. You can create a type libray in this way. MyAssembly.dll can be also MyAssembly.exe
It is important that you do not check the
Project/Properties/Application/Assembly Information... Make assembly COM-Visible.
This option will set [assembly: ConVisible(true)] in the AssemblyInfo.cs file
Which will make all the Class in the Project COM visible. This in practice will make C# to generate new Guids for each class on which we did not specify a Guid attribute each time we recompile, causing a registry bloat.
It is much better to set
[assembly: ConVisible(false)], and use ComVisible(true) at class level to specify which class should be visible for COM interop .
Project/Properties/Build tick Register for COM interop. (Reccomended Choice)
Otherwise you need to use REGASM (see here for the asembly registration tool). The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. This utility is necessary when you need to expose to COM e .exe (winform application) .net assembly. You can create a type libray in this way. MyAssembly.dll can be also MyAssembly.exe
It is important that you do not check the
Project/Properties/Application/Assembly Information... Make assembly COM-Visible.
This option will set [assembly: ConVisible(true)] in the AssemblyInfo.cs file
Which will make all the Class in the Project COM visible. This in practice will make C# to generate new Guids for each class on which we did not specify a Guid attribute each time we recompile, causing a registry bloat.
It is much better to set
[assembly: ConVisible(false)], and use ComVisible(true) at class level to specify which class should be visible for COM interop .
How to Register / UnRegister a C# COM Exposed DLL manually an with VS 2008
To Register a C# COM Exposed Dll you I reccomend to create a Register.Bat file with the following instruction
------------------------------------------------------------------------------------------------------
REM Set the search directories
path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;
REM we first Unregister the .NET dll and then register it
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
regasm.exe /codebase "FullPath\MyLibrary.dll" /tlb
pause
-----------------------------------------------------------------------------------------------------
This insturction set the search path for the regasm.exe file. I have included the most common directory that should have it
path=%path%; .......
This line unregister the Dll and its typelibrary
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
This one creates the type library and register the dll with its full Path and along the type library.
If you do not use the /codebase option VB will complain that it cannot find the library.
regasm.exe /codebase "FullPath\MyLibrary.dll" /tlb
To unregister make an unregister.bat file
---------------------------------------------------------------------------------------------
REM Set the search directories
path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;
REM we Unregister the .NET dll
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
pause
-----------------------------------------------------------------------------------------------------
When you use the code base option you need to have a strongly type Assembly (Dll) To do this
follow these steps
Go to Properties/Signing. Tick Sign the assembly check box.
Then go to Choose a stroing name key file
Choose a name ex "MyLibrary_COM_Key"
This will create a MyLibray_COM_Key.snk file in the project folder.
Lastly you also need to make sure that the Assembly Version is not someting like 1.0.* which means that each time you rebuild the project the assembly name changes. Just give the assembly a version, something like 1.0.0.0 and stick with it. The call to the COM exposed DLL is also connected to the assembly version registered in the registry.
------------------------------------------------------------------------------------------------------
REM Set the search directories
path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;
REM we first Unregister the .NET dll and then register it
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
regasm.exe /codebase "FullPath\MyLibrary.dll" /tlb
pause
-----------------------------------------------------------------------------------------------------
This insturction set the search path for the regasm.exe file. I have included the most common directory that should have it
path=%path%; .......
This line unregister the Dll and its typelibrary
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
This one creates the type library and register the dll with its full Path and along the type library.
If you do not use the /codebase option VB will complain that it cannot find the library.
regasm.exe /codebase "FullPath\MyLibrary.dll" /tlb
To unregister make an unregister.bat file
---------------------------------------------------------------------------------------------
REM Set the search directories
path=%path%;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\Program Files\Microsoft.NET\SDK\v1.1\Bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;
REM we Unregister the .NET dll
regasm.exe /u "FullPath\MyLibrary.dll" /tlb
pause
-----------------------------------------------------------------------------------------------------
When you use the code base option you need to have a strongly type Assembly (Dll) To do this
follow these steps
Go to Properties/Signing. Tick Sign the assembly check box.
Then go to Choose a stroing name key file
Choose a name ex "MyLibrary_COM_Key"
This will create a MyLibray_COM_Key.snk file in the project folder.
Lastly you also need to make sure that the Assembly Version is not someting like 1.0.* which means that each time you rebuild the project the assembly name changes. Just give the assembly a version, something like 1.0.0.0 and stick with it. The call to the COM exposed DLL is also connected to the assembly version registered in the registry.
Microsoft Visual Studio Registy Capture Utility has stop working Error
If you have this error while you are trying to use VS 2008 Project Setup and Development, do the following:
- Locate regcap.exe here: C:\Program Files(x86)\Microsoft Visual Studio 9.0\Common7\Tools\Deployment
- Right click and select properties.
- Select Compatibility tab
- Check box to Run this program in compatibility mode.
- Select Windows Vista SP2 in the OS drop-down and Run as Administrator.
- Click Ok and Recompile.
Subscribe to:
Posts (Atom)