Wednesday, May 4, 2011

A Bizarre .NET Linking Error, So Just Reconfigure LC.exe. Naturally.

To eliminate the necessity of deploying certain third-party DLL's with applications that don't need them but which link to assemblies that do, I removed my wrappers for those DLL's to a new project and only added references to that new project where necessary.

Unfortunately, after doing this, I began to get this error (with Visual Studio 2010 SP1):

Could not load file or assembly 'Dart.PowerTCP.Ftp' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Googling around suggested that I should press the "Unblock" button, but the assembly hadn't been downloaded, and didn't have an Unblock button.

What eventually worked for me was what I found at http://www.devexpress.com/Support/Center/p/B192717.aspx which was to do this:

The solution is to 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…on Win 7 x64 that's usually:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
 That did it for me.  Note that my My Documents folder is on a Windows file share, so all my solutions and projects are on a remote server.  But the DLL in question was not actually remote... ah the mysteries of life.