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

  • SEARCH
  • Home
  • 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 8980219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:01:36+00:00 2026-06-15T20:01:36+00:00

I was having trouble getting Visual Studio to build my project in release mode…

  • 0

I was having trouble getting Visual Studio to build my project in release mode… it gives me errors about assemblies being the wrong format. Turns out some x86 assemblies were being referenced instead of x64 assemblies. Assemblies like PresentationCore, System.Data and so on.

Things I’ve tried:

  • Debug mode, any CPU builds fine.

  • Debug mode, x64 builds fine.

  • Release mode, any CPU fails

  • Release mode, x64 fails (this is the combination I’d LIKE to build my project in)

The issue comes when I try to remove the x86 reference and switch it to a x64 reference. Visual studio just adds the old x86 reference instead of the x64 reference. For example:

I remove the System.Data reference which is in C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll

I browse to and add C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Data.dll, but when I click on that System.Data reference, the path is CLEARLY still to the old dll and causes the same error to occur. This is happening with several other DLLs as well.

Does anyone know of a solution to this issue?

  • 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-15T20:01:38+00:00Added an answer on June 15, 2026 at 8:01 pm

    Assemblies like PresentationCore, System.Data and so on.

    I hate to answer a question without seeing the error message. But this secondary evidence is enough to answer the question. First off, this is not an error, it is a warning. It looks like this:

    warning CS1607: Assembly generation — Referenced assembly ‘System.Data.dll’ targets a different processor

    You’ll also see one for mscorlib.dll. And PresentationCore.dll in a WPF project. What goes on here is that these assemblies are special, they are mixed-mode assemblies. In other words, they contain both native code and managed code. The native code is the trouble-maker, such an assembly can only be used in a project that targets the right processor flavor. If you mix it up then you get a BadImageFormatException at runtime.

    This is not a real problem with .NET assemblies, your machine actually has two versions of these DLLs stored in the GAC. One that will be used if your program runs in 32-bit mode and another that is used in 64-bit mode. The CLR automatically picks the right one.

    However, there is only one version of the reference assembly, the one that’s stored in c:\windows\microsoft.net and that you pass to the compiler to read the metadata from. It is always the x86 version, there’s no other one so don’t bother looking for it. Again, this is not a problem, only the metadata of a reference assembly is used by the compiler, it doesn’t execute any of its code. And the metadata does not depend on the bit-ness of the assembly.

    Nevertheless, this all might be a problem if you create your own mixed-mode assembly. You can easily overlook the need to provide two versions. So what the compiler is fretting about is that it sees that you asked for an AnyCPU or x64 build of your project. But detects that the reference assembly can only work when you target x86. So it squeaks at you a bit, just a gentle reminder that there’s some evidence that you’re getting it wrong and that your program might fall over on a BadImageFormatException when you run it. It doesn’t otherwise treat a framework reference assembly any different from your own reference assembly.

    So, feature, not a bug. Just a warning that doesn’t otherwise prevents your program from building. You can safely ignore the warning since you know that .NET has the right assembly available in the GAC at runtime. Notable is that .NET 4.0 doesn’t have this problem, it uses very different reference assemblies that don’t have the ILONLY metadata flag turned off.

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

Sidebar

Related Questions

I'm completely new to Visual Studio and I'm having some trouble getting a project
I am having trouble getting Visual Studio to behave as I would expect it.
I've been having trouble getting TypeScript for Visual Studio 2012 to work. Does anyone
I'm having a little trouble building my application as Release in Visual Studio 2008.
I'm having trouble getting Code Analysis to run on the build server. My goal
I am having trouble getting the EF to install on my very simple project
I have Visutal Studio 2012, MVC 4 & Razor. I am having trouble getting
I'm having trouble getting a vsto project to work. It's a simple Word 2007
I am having trouble getting my project to link to the Boost (version 1.37.0)
im having trouble getting a string (containing a URL) from one activity to another.

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.