1

I've setup NSass from NuGet. It's a managed wrapper around libsass and has a HTTP handler that does on-the-fly compilation of .scss files to CSS.

The problem is that the handler throws the following arcane InvalidOperationException:

Found NSass.Wrapper.proxy.dll which cannot exist. Must instead have NSass.Wrapper.x86.dll and NSass.Wrapper.x64.dll. Check your build settings.

I can see that the code and message is copy-pasted from some trickery found here (see bottom):

Load x64 or a x86 DLL depending upon the platform?

So my guess was that my web project needed to target x64 specifically, maybe to force a decision on the unmanaged library being used.

That just ends with a BadImageFormatException maybe due to IIS Express being 32-bit which I've seen being a PITA with Oracle dependencies - I gave up then, too.

Community
  • 1
  • 1
Luke Puplett
  • 42,091
  • 47
  • 181
  • 266

2 Answers2

2

I think, due to the unmanaged library, AnyCpu cannot be used for the project, instead you must pick a target processing platform.

For me that's 64-bit but IIS Express is a 32-bit process. I recall having similar issues with unmanaged references, bitness and IIS Express (32) vs. production (64) with Oracle libraries.

So when IIS Express tries to load the x64-targeted website assembly, it blows up.

I am now looking into a compile time CSS compilation, rather than runtime, using Web Workbench or something.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
1

I got the same issue, and the reason for it was that the NSass.Wrapper.XXX.dll files were not copied into the output directory.

aph5
  • 771
  • 2
  • 7
  • 23