Skip to main content Skip to footer

Referencing 4.0 Controls from Network Location

When any third party dll like our ComponentOne Controls are referenced from a network path instead of the default Program Files folder, then one of the following exceptions are observed : "Could not load file or assembly or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)'" "Could not load file or assembly or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)" For instance, on accessing C1Command 2.0 build from the network path, 'Could not load file or assembly 'C1.Win.C1Command.2, Version=2.0.20113.19505, Culture=neutral, PublicKeyToken=e808566f358766d8' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)' error is observed. However, this is actually a security limitation and it has nothing to do with the controls. It seems to be a combination of Windows 7, targeting the .NET 4.0 framework, and referencing assemblies located on a network share. This blog provides a solution to solve the referencing problem. The solution is simple. Just add a .config file for the license compiler which includes the element. Just create a new lc.exe.config file and include this content:

<?xml version ="1.0"?>  
    <configuration>  
       <startup useLegacyV2RuntimeActivationPolicy="true">  
          <supportedRuntime version="v4.0.30319"/>  
       </startup>  
       <runtime>  
          <loadFromRemoteSources enabled="true"/>  
       </runtime>  
   </configuration>

Then copy it to the folder where LC.exe resides on your machine. Win 7 32 bit : C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools Win 7 x64 bit : C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools After the lc.exe.config file is added in the NETFX 4.0 Tools folder you have to restart VS2010. Following is some more information from Microsoft : In the .NET Framework version 3.5 and earlier versions, if you loaded an assembly from a remote location, the assembly would run partially trusted with a grant set that depended on the zone in which it was loaded. For example, if you loaded an assembly from a Web site, it was loaded into the Internet zone and granted the Internet permission set. In other words, it executed in an Internet sandbox. If you try to run that assembly in the .NET Framework version 4, an exception is thrown; you must either explicitly create a sandbox for the assembly, or run it in full trust. The element lets you specify that the assemblies that run partially trusted in earlier versions of the .NET Framework should be run fully trusted in the .NET Framework 4.

MESCIUS inc.

comments powered by Disqus