Support Notes: Deploying the Salience assemblies on a Windows network drive

December 20th, 2012 by Carl Lambrecht

This is a brief note from a professional services engagement we have in progress currently. Our professional services folks are developing a custom Excel plugin for a client that uses Salience for analyzing the content contained in their worksheets within the familiar Excel environment.

The Excel plug-in integrates with Salience through a Microsoft Office add-in written in C# and the Salience .Net wrapper. The client wanted the end-user desktops to only have the add-in installed, with Salience and its related data directory residing on a mapped network drive. Read on to see how we accomplished this.

Initially, there was an issue getting the add-in to connect to the Salience .Net wrapper residing on the network drive. Our professional services folks noted the error message:

Could not load file or assembly ‘SalienceFive.NET, Version=5.1.6720.64, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0×80131417)

One of our sharp professional service guys, Kevin, found the command needed to grant trust to the network-resident .Net assembly to solve the problem:

C:\Windows\system32>c:\Windows\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -pp off -machine -addgroup 1.2 -url file:///l:/Salience/bin/* FullTrust

So what does this command actually say/do? According to MSDN, caspol.exe is the Code Access Security Policy tool, which “enables users and administrators to modify security policy for the machine policy level, the user policy level, and the enterprise policy level.”

What we’re doing by invoking this command through caspol is telling the machine that we trust the code that is in the specified location on the network (in this case, the mapped drive), which is exactly what the Excel add-in needs in order to invoke it as if it was locally installed.

See Code Access Security Policy Tool on MSDN for more information.

Comments are closed.