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 830259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:00:59+00:00 2026-05-15T04:00:59+00:00

I have an existing C# application written for .NET 2.0 and targeting AnyCPU at

  • 0

I have an existing C# application written for .NET 2.0 and targeting AnyCPU at the moment. It currently references some third party .NET DLLs which I don’t have the source for (and I’m not sure if they were built for x86, x64 or AnyCPU).

If I want to run my application specifically on a 64 bit Windows OS, which platform should I target in order for my app to run without errors? My understanding at the moment is to target:

  • x86: If at least one third party .NET dll is built for x86 or use p/Invoke to interface with Win32 DLLs. Application will run in 32 bit mode on both 32 bit and 64 bit OSes.
  • x64: If all third party .NET dlls are already built for x64 or AnyCPU. Application will only run in 64 bit OSes.
  • AnyCPU: If all third party .NET dlls are already built for AnyCPU. Application will run in 32 bit mode on 32 bit OSes and 64 bit on 64 bit OSes.

Also, am I right to believe that while targeting AnyCPU will generate no errors when building a application referencing third party x86 .NET DLLs, the application will throw a runtime exception when it tries to load these DLLs when it runs on a 64 bit OS.

Hence, as long as one of my third party DLLs is doing p/Invoke or are x86, I can only target x86 for this application?

  • 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-05-15T04:01:00+00:00Added an answer on May 15, 2026 at 4:01 am

    You can do P/Invoke from an AnyCPU DLL, you just need to be a bit more careful about the P/Invoke definitions (i.e. that you’re not inadvertently assuming 32-bit or something). The problem is that it’s kind of hard to know if a 3rd party DLL is doing the right thing without Reflector and disassembling it (unless the developer specifically states 64-bit support of course).

    But other than that, you’re pretty much spot-on.

    To be honest, for 99% of applications, targetting x86 is perfectly acceptable. It’s a relatively small number of applications that actually benefit from being 64-bit. (Performance issues typically come out as a bit of a wash: more registers are offset by the register renaming of x86 mode and larger data structures because pointers are twice as big [and in a reference-heavy system like .NET that’s even worse])

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

Sidebar

Related Questions

Let's say I have an existing application written in Java which I wish to
an application I have written uses several third party jars. Sometimes only a small
I have written a Windows Service which listens for data from a third party
If I have a number of existing applications written and deployed w/ .NET 1.1,
I have an existing application that is written in C++ for Windows. This application
I'm supporting an existing application written by another developer and I have a question
I am implementing NHibernate into an existing web application. However, we have some other
I have a fairly complex business application written in ASP.NET that is deployed on
I have existing application which uses Sql server 2005 as a backend. It contains
I have an existing application that has some parts of formatted text-blocks (standard formats

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.