Create a COM-Accessible VB.NET Library
Step 1. Create a New Project
Open Visual Studio and create a new VB class library project called MyFips140Crypto.
Step 2. Add the Code
Rename Class1 to SHA and add the following code:
Step 3. Enable COM
To enable COM support, open the project properties and click the Assembly Info button. Fill in the dialog any way you want, but make sure that Make assembly COM-Visible is checked.
Step 4. Give It a Strong Name
What is a "strong name," you ask? TBD
Lucky for us, this isn't too hard to do. From the project properties page, you can have Visual Studio create a new strong name key file for you. You can optionally protect the key file with a password.
Once the strong name key file is associated with your project, you generally don't have to worry about it again.
Step 5. Build It
Build the project.
Step 6. Register It
Open Visual Studio 2005 Command Prompt. It is one of the tools that comes standard with Visual Studio. Navigate to the folder where your compiled DLL is going to reside, and type in the following command:
The /codebase parameter must be specified. If you forget, the assembly will appear to be registered correctly, but you will get a "Could not co-create object" exception when you try to run this from Groovy.
If you have been lucky enough to get everything right so far, you'll get a confirmation message telling you that the assembly was registered successfully. Congratulations!
If you are using Visual Studio Express, you may not have a Visual Studio 2005 Command Prompt. The regasm.exe utility is available on your machine, and you can access it by searching for the file and adjusting your path environment variable, or by installing the full Microsoft.NET SDK.