Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC3 runtime error when trying to load a 64-bit C++/CLI assembly
    primarykey
    data
    text
    <p><strong>Update:</strong> Question updated after figuring out what was causing the ASP.NET/Razor errors.</p> <p>I have an ASP.NET MVC3 project that references a C++/CLI project which is configured to compile as x64 because it has to run in Windows Azure (No AnyCPU setting for C++/CLI).</p> <p>The problem is that as soon as I configure the platform settings of the C++/CLI project to x64 (In Build->Configuration Manager), build the solution, then open a random view I get a warning about ASP.NET trying to load an incorrect format assembly followed by a bunch of errors caused by Razor syntax errors.</p> <p>Screenshot of some random View:<br> <img src="https://i.stack.imgur.com/NtSFz.png" alt="enter image description here"></p> <p>Screenshot of the log: <img src="https://i.stack.imgur.com/BG8Ml.png" alt="VS2010 Error List"></p> <p>The main error is:</p> <blockquote> <p>Warning: ASP.NET runtime error: Could not load file or assembly 'LZGEncoder' or one of its dependencies. An attempt was made to load a program with an incorrect format.</p> </blockquote> <p>Even though this happens, I can still compile and run the solution, and use the referenced C++/CLI assembly just fine, so this isn't blocking development but it's a real nuisance (especially when it blocks IntelliSense and I can't see if I have any <em>real</em> errors in my Razor code).</p> <p>If I reset the platform of my C++/CLI to Win32 then all the errors disappear, but ofcourse when running the solution I get the same incorrect format error but in my MVC3 web-page. </p> <p>Is this a bug in ASP.NET or have I forgotten to configure something? I was able to reproduce the errors at work and at home (with and without Azure), so I don't think it's my VS2010 installation. Thanks.</p> <p><strong>Update:</strong><br> For now I created a C# wrapper directly calling the C library using P/Invoke, and it works great, so I don't even need the C++/CLI wrapper anymore, but that doesn't answer this question so I'll keep it open.</p> <p>I'm suspecting it's a bug in MVC3/Razor or VS2010 though, both which have new versions coming out soon.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload