This project has moved. For the latest updates, please go here.

"Could not load file or assembly" error with VST.NET version 1.0 and .NET Framework 4.0

Topics: Backward Compatibility, Crash, Debugging, Newbie
Nov 5, 2012 at 3:25 PM

I've downloaded the 1.0 version (excellent) but am having trouble upgrading my VST to use it. Here's the message that appears when I load my VST:

http://i.imgur.com/G1p5h.png

(Sorry, copy/pasting the text doesn't seem to work on the dialog box like it usually does)

Here's what I've done:

  • Replaced the old .Core and .Framework Dlls with the latest ones from VST.NET RTM.zip\Code\CLR4\AnyCPU\Release  
  • Updated the project References to point to those new assemblies
  • Changed the project Target Framework  to .NET Framework 4
  • Took the new Interop.dll from  \VST.NET RTM.zip\Code\CLR4\x86\Release, renamed it to MyPlugin.dll, and put it in my VST plugins directory.

The project builds cleanly, and I have a post-build step to copy my output Dll to the VST plugins directory as  MyPlugin.net.vstdll .

I'm running on Windows 7 64-bit, but targeting a 32-bit VST to match the host (FL Studio, which is 32-bit for now).  Using Visual Studio 2011 beta.

I'm hoping I missed or did something simple.  Suggestions?  Thanks!

Nov 5, 2012 at 5:22 PM
Edited Nov 5, 2012 at 5:27 PM

--- 

Nov 5, 2012 at 5:23 PM
Edited Nov 5, 2012 at 5:27 PM


Huh.  I got it working, it seems this behaviour is by design in .NET 4.  These pages have some details:  

http://msdn.microsoft.com/en-us/library/dd409252(v=vs.100).aspx

http://through-the-interface.typepad.com/through_the_interface/2011/07/loading-blocked-and-network-hosted-assemblies-with-net-4.html

http://jopinblog.wordpress.com/2007/05/01/configuration-file-appconfig-for-net-class-library-dll/

What wasn't obvious though until I read that last article, is that you have to create the .config file *for the host executable*, not the DLL.  This applies even though the host isn't a .NET program!So in my case, I created a file called FL.exe.config  (For FL Studio) and put it in the FL executable directory, with these contents:

<?xml version ="1.0"?>
  <configuration>   
    <runtime>       
      <loadFromRemoteSources enabled="true"/>
    </runtime>
  </configuration>

Now it works.   But I still think something is wrong as for why .NET is thinking it has to do this, so some digging into the root cause would be great.

Coordinator
Nov 5, 2012 at 8:32 PM

Check the .zip file you've download from codeplex. Go to its file properties and click the unblock button at the bottom. Now unpack again and overwrite the assemblies with the new ones... I think you can remove the FL.exe.config.

Because you've downloaded the files from the internet and windows marked the file as 'blocked'  - and because its a .zip the files it contains are also blocked. .NET considers downloaded files as unsafe by default.

I will update the release notes to include this info.

Hope it helps,
Marc 

Nov 6, 2012 at 2:56 PM

Unfortunately, I don't have the "Unblock" option on the File Properties window, for either the original .zip or the extracted files.  I also tried logging in as an Administrator, no difference.

Coordinator
Nov 6, 2012 at 6:29 PM

What OS are you running??

Nov 6, 2012 at 7:42 PM

Windows 7 Enterprise 64-bit, Service Pack 1.  VER gives "Microsoft Windows [Version 6.1.7601]".

Coordinator
Nov 7, 2012 at 8:16 AM

I run Windows 7 Enterprise SP1 and I have an unblock button!? I just downloaded a new copy and checked.

Just to be sure: You right-click on the downloaded .zip file in the Windows Explorer and choose "Properties" from the context menu. Then you should have an "Unkblock" button on the bottom of the General Tab...

Also, download the file to the standard download folder of the browser - or otherwise in a temp folder or something. I read that some weird stuff can happen on different locations (Desktop, My Documents etc).

Nov 7, 2012 at 7:38 PM
Edited Nov 7, 2012 at 7:39 PM
Precisely.    But, no Unblock button.  I'm using Chrome as my browser, downloaded to my Downloads directory (C:\Users\lbloomqu\Downloads for me).
Coordinator
Nov 8, 2012 at 5:29 AM

I am sorry but I have no solution for you. Search the web for an answer why your Unblock button is gone...

Also, you could check if there is another tool that can accomplish the same task. I'm thinking about the MS/SysInternals Disk and File tools...

http://technet.microsoft.com/en-us/sysinternals/bb545046

 

Hope it helps.