Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 4
    This rule makes sense to me. But consider the following situation: Native.dll (x64) used by NetA.dll (Any CPU) used by NetB.dll (Any CPU) used by App1.exe (x64). There is no real problem here, but compiling NetA.dll gives me the warning. OK, since this assembly directly depends on Native.dll, I could mark it as x64 also. But then compiling NetB.dll complains. I want to keep NetB.dll as "Any CPU" because it is a common assembly used in a different, pure-dot-net application. I conclude that my only option is to suppress/ignore the warning. Yes? Commented Jun 29, 2015 at 19:00
  • 2
    Because of the dependency on Native.dll, your entire app/assembly lineage is now x64, whether your suppress the warning or not. While suppression works in your scenario, weird situations could arise in the future. For example, 1) assembly NetB is used in an x86 environment, where Nativex64 will not load, or 2) your customer wants an x86 version of App1.exe, and you compile happily, since NetB is marked as any CPU, but again, Nativex64 at the top of the stack will not load Commented Aug 20, 2015 at 22:30
  • While Gustavo's rule is a good principle, it cannot be used for the specific problem asked in this question as the project already has a dependency on a 3rd party assembly that didn't follow the rule (it's x86, not AnyCPU). Hence as long as the dependency is there the whole chain of projects must target x86 and nothing else. Commented Dec 7, 2018 at 0:48

default