5

I am getting this error when I bring up the website from within Visual Studio 2013. LibSass.x64.dll & libsassnet.dll are in the bin folder.

Could not load file or assembly 'LibSass.x64' or one of its dependencies

Tony_Henrich
  • 42,411
  • 75
  • 239
  • 374
  • What happened to me was I didn't realise there were 2 version in the nugent package manager. I installed LibSass, not seeing LibSass.x64. – BenG Sep 15 '16 at 13:18

3 Answers3

6

You can switch to 64 bit IIS Express in Visual Studio settings:

Tools > Options > Projects and Solutions > Web Projects > Use the 64 bit version of IIS Express for web sites and projects.

Update: If you get this error on a clean Windows machine, you have to install Visual C++ Redistributable Packages for Visual Studio 2013.

I recommend to install both x86 and x64 packages.

Dartal
  • 432
  • 2
  • 5
  • Yes this was the issue for us but we were installing the redistribute package for 2012 but were building the solution in 2013 so we had to install 2013 package. So looks like package needs to match build version. – craigvl Jun 03 '16 at 00:39
1

It is a known issue with libsassnet. Basically you need correct library referenced, either 32 bit or 64 bit. In our project we reference 64 bit and thus project needs to be compiled and run in 64 bit environment. By default IIS Express runs in 32 bit (since VS.NET runs in 32) so that is why you get an exception.

Better create an IIS site and run it using it or you can modify nuget reference of libsassnet to 32 bit version.

PS: we resolved that automatically in azure deployment, but still working with libsassnet developers to resolve it when it is deployed locally.

Woland
  • 2,881
  • 2
  • 20
  • 33
  • Could you elaborate on how exactly to reference the 32 bit version? I just downloaded the latest Virto 2.x release and when I deploy to the free Azure web app I am hosting it on, 64-bit is not an option. I don't see any reference to libsass in the list of nuget packages. I eventually figured out that I can manually delete the libsass and LibSass.x64.dll files from the bin folder after deployment, but I know there has got to be a better way. I know I must be missing something obvious. – N1njaB0b Aug 24 '15 at 00:11
  • the latest version already has a fix that automatically references the correct dll depending on the environment used, no need to do anything above. It is done now in runtime and both dlls are included with a project. – Woland Aug 24 '15 at 04:48
  • It certainly looks like it _should_ work that way. I see the LibSassNetProxy, and I see the x64 and x86 dlls in the App_Data folder, but when I deploy to my 32-bit Azure site, I still get the "Could not load file or assembly 'LibSass.x64' or one of its dependencies" error, despite the fact that my platform target for all the projects in the solution is set to x86. – N1njaB0b Aug 24 '15 at 13:07
  • Ok, we'll try troubleshooting it and see why it is not loading 32 bit. – Woland Aug 24 '15 at 16:12
  • There is a MSBuild target named DeleteLibSassFilesFromBin in the VirtoCommerce.Website.csproj. It deletes libsassnet.dll and LibSass.x64.dll from $(OutputPath) after build. Please try to change $(OutputPath) with $(WebProjectOutputDir)\bin\. Here is the full path: $(WebProjectOutputDir)\bin\libsassnet.dll. If it will work for you I'll commit this fix to GitHub. – Dartal Aug 24 '15 at 16:59
  • Sorry, no dice. I have confirmed that the target does indeed run and work, but apparently this does not affect the Web Deploy Package. For now, my new workaround is to change the "Build Action" from "Content" to "None" in the properties for the libsassnet.dll and LibSass.x64.dll files, but I would be happy to try any other suggestions you have. – N1njaB0b Aug 25 '15 at 00:33
0

Looks like the latest version requires the VC++ 2015 version: https://www.microsoft.com/en-us/download/details.aspx?id=48145

Law
  • 21
  • 1