Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In my case, I have a suite of add-ins under MyCompany.Office.</p> <p>I have a shared library of core functionality called MyCompany.Office.dll, which is referenced by MyCompany.Office.Word.dll and MyCompany.Office.Excel.dll, which are both add-ins (you could easily have multiple add-ins for Excel rather than one for Word and one for Excel, or whatever you want).</p> <p>What I did was create a strong name keyfile for the solution and linked it in all three projects. I then signed all three libraries with the same strong name keyfile.</p> <p>I then created an Installer Action that adds a CAS entry using the public key as evidence, rather than the file location. so, my custom action ultimately invokes <code>caspol.exe -m -q -ag "My_Computer_Zone" -strong -hex &lt;my public key&gt; -noname -noversion FullTrust -n "MyCompany_Office" -d "Code group for MyCompany.Office add-ins."</code>. This gives FullTrust to all libraries with that public key.</p> <p>You can view the public key by opening a command prompt, navigating to the keyfile location and typing <code>sn -Tp mykeyfile.snk</code>. If you want to get the public key pro grammatically (like extending SetSecurity), you could use code like this:</p> <pre><code>private static String GetPublicKeyHexString(String assemblyPath) { AssemblyName assmName = Assembly.LoadFile(assemblyPath).GetName(); StringBuilder output = new StringBuilder(); Byte[] publicKey = assmName.GetPublicKey(); foreach(Byte byte in publicKey) { output.Append(byte.ToString("x").PadLeft(2, '0')); } return output.ToString(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload