home *** CD-ROM | disk | FTP | other *** search
-
- <!-- #include virtual="/quickstart/howto/include/header.inc" -->
-
- <%
- runsample = Server.MapPath("/quickstart/howto/samples/assemblies/sharedname")
- icon = "/quickstart/images/genicon.gif"
- caption = "Build.bat"
- %>
-
- <h4>How Do I...create an assembly with a shared name?</h4>
-
- <div class="indent" style="WIDTH: 660px">
- This sample demonstrates how to create an assembly with a shared name...
- </div>
-
- <h4>Example</h4>
-
- <p>
- <div class="indent">
- <a target="_blank" href="<%=runsample%>">
- <img style="border-color:black" border=1 src="<%=icon%>"><br>
- </a>
- <div class="caption"><%=caption%></div><br>
- </div>
-
- <h4>Shared Names</h4>
- <div class="indent" style="WIDTH: 660px">
- <P>Shared names are used to provide name uniqueness and to prevent name spoofing
- in the NGWS runtime. If you are deploying an assembly that will be shared among many
- applications on the same machine, it must have a shared name. Even if you
- will only use the assembly within your application, you may want to give it a
- shared name as well. In this way you can ensure that the assembly you
- shipped as part of your app is in fact the exact one that gets loaded, i.e
- someone didn't substitute a similar assembly, either maliciously or by accident,
- for yours.</P>
- <P>The first step in building an assembly with a shared name is to get a
- key-pair. Depending on your scenario you may have a secured key pair that is
- used throughout your organization, or you may use a test or temporary key pair.
- Details on these options and Shared names in general are available in the Shared
- Name Spec in the NGWS SDK. </P>
- <P>This sample uses a test key in a file called TestKey.snk. TestKey.snk was
- generated with the SN utility that ships in the SDK: </P>
- <P>sn -k Testkey.snk </P>
- <P>After you've obtained a key pair you need to add the proper switches so the
- compiler emits the assembly with a strong name. These switches vary by compiler.
- For this sample, the C# compiler is used with the /a.keyfile switch: </P>
- <P>csc /dll /a.keyfile:Testkey.snk sharedname.cs </P>
- <P>There are also options available to do a "partial sign", meaning that the
- space for the signature is reserved in the PE file, but the signing itself is
- not done until a later step. This approach is typically used if you don't have
- access to the private key you'll need to generate the shared name. More details
- on how these options work can be found in the Shared Name Spec. </P>
- <P>The batch file that ships with this sample runs SN to generate a key pair,
- builds a shared named assembly with C#, then dumps the metadata and displays it
- in a file. By looking at the "Originator" field in the output file, you
- can see the public key used to generate the shared name. The signature
- blob itself is stored elsewhere in the PE file.</P>
-
- </div><!-- #include virtual="/quickstart/howto/include/footer.inc" -->
-