In this method, we will only describe the different steps with respect to the previous method. Follow the steps 1.1 to 1.4 same as in the previous post and build the project. The code of the project is shown in the figure below:
The next step is of signing the assembly. To do this, you have to move to the properties window of the project as illustrated in the step 1.5. Select the Signing Pane of the properties window and check the “Sign the Assembly” option. Select <New…> from the “Choose a strong name key file:” and give the name that you desired. In our case, we named it “HELLOWORLD” as shown in the figure below:
We will build by pressing F6 or clicking on Build in the tolls menu and then clicking on Build Solution. Build will generate the file in the debug directory of the project.
The file HELLASSEMBLY.dll can be found in the debug folder whose path in our case is as fellow C:\Documents and Settings\ffaiz\My Documents\Visual Studio 2005\Projects\HELLOGAC\HELLOGAC\bin\Debug. Depending upon your installation, you can find the file in the debug folder. Copy the file “HELLOASSEMBLY.dll” from this folder and paste it in the GAC folder which is normally found at C:\WINDOWS\assembly. After copying the file in the GAC, copy the public token key as encircled in the figure below:
We have to add the reference to the web.config. The file will be located in the folder created by MOSS. In our case, the path of the file is C:\Inetpub\wwwroot\wss\VirtualDirectories\80. We will open the file in the Visual Studio and go to the tag <SafeControls>. Here we will add a new entry for our web part in the <SafeControls> tag which is <SafeControl Assembly=”HELLOASSEMBLY, Version=220.127.116.11, Culture=neutral, PublicKeyToken=ae23d1c2ca8c8a6e” Namespace=”HELLOGAC” TypeName=”*” Safe=”True” />, encircled in the figure below:
Note here that the public Key Token copied from the GAC has been added in the <SafeControl> tag of the Assembly.
Rest of the steps is same as that of the previous post. Follow those steps to add the web part in the site.