Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8294211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:07:16+00:00 2026-06-08T14:07:16+00:00

Update: Question updated after figuring out what was causing the ASP.NET/Razor errors. I have

  • 0

Update: Question updated after figuring out what was causing the ASP.NET/Razor errors.

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).

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.

Screenshot of some random View:
enter image description here

Screenshot of the log:
VS2010 Error List

The main error is:

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.

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 real errors in my Razor code).

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.

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.

Update:
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.

I’m suspecting it’s a bug in MVC3/Razor or VS2010 though, both which have new versions coming out soon.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:07:17+00:00Added an answer on June 8, 2026 at 2:07 pm

    I figured out what was causing the problem, it was the fact that the C++/CLI dll was being compiled as x64. The ASP.NET runtime doesn’t seem to like that, and only plays nice with Win32 or AnyCPU platforms, even though the code does compile and run.

    The only 2 platform options for a C++/CLI project are Win32 and x64, and I needed it to be x64 since it was going to be published to the Azure cloud, but that would cause these runtime errors, and on the other hand Win32 would not run on Azure at all.

    What I ended up doing was creating a C# wrapper that directly calls my C library using P/Invoke, since C# project platform setting can be set to “AnyCPU”, so now the errors are gone.

    So in summary, if you’re referencing any type of project/dll in a solution that contains Razor code, make sure it’s compiled as AnyCPU or Win32, not x64.

    Thanks everyone! I guess it is a bug in ASP.NET MVC3 afterall.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please read my update at the end of question after reading the answers: I'm
Update 7/17 SOLVED I've updated my code to the Solved version. Original Question I'm
Updated question, see below I'm starting a new project and I would like to
Edit (updated question) I have a simple C program: // it is not important
I've updated the title and the text of my original question after gaining more
Short Question I have a loop that runs 180,000 times. At the end of
I have a WCF service that uses ODP.NET to read data from an Oracle
(Title and contents updated after reading Alex's answer) In general I believe that it's
After posting this question MySQL update or insert or die query I've change to
Recently I've studied the backpropagation network and have done some manual exercise. After that,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.