Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing a Visual Studio C# project from x86 to Any CPU

I am working on some C# projects with Visual Studio 2005, and I am trying to change the platform target from x86 to Any CPU. I already went through all the dependencies that I know about and made sure that they were also built for Any CPU using the corflags tool.

When I change the platform target in Visual Studio 2005 it seems like it saves the change, but then when I build the project it still uses x86 anyway. The next time I open the project the platform target has been reset to x86.

This only happens for a couple of the projects in the solution, does this mean that there are other 32-bit dependencies somewhere?

I can manually run the C# compiler on the command line with /platform:anycpu and I don't get an error, but I'm not sure that is the right thing to do and I'd like to be able to build within Visual Studio.

What can I do to solve this problem?

like image 977
WildCrustacean Avatar asked Jan 27 '10 14:01

WildCrustacean


People also ask

How do I change from Visual Studio to C sharp?

Visual Studio doesn't provide a UI to change the value, but you can change it by editing the csproj file. The choice of default ensures that you use the latest language version compatible with your target framework. You benefit from access to the latest language features compatible with your project's target.

Is there C in Visual Studio?

Visual Studio Code is a lightweight, cross-platform development environment that runs on Windows, Mac, and Linux systems. The Microsoft C/C++ for Visual Studio Code extension supports IntelliSense, debugging, code formatting, auto-completion.

How do I change compiler in Visual Studio?

In Visual Studio You can set compiler options for each project in its Visual Studio Property Pages dialog box. In the left pane, select Configuration Properties, C/C++ and then choose the compiler option category.

How do I type C in Visual Studio?

Visual Studio comes with its own C compiler, which is actually the C++ compiler. Just use the . c file extension to save your source code. You don't have to be using the IDE to compile C.


1 Answers

Make sure you've changed both the Configuration Platform and the Platform Target to Any CPU. If all else fails you can open up the .csproj and manually change the references. Right click on the Project, goto Unload Project. Then right click and goto Edit MyProject.csproj. The properties for the project may still include the default Platform as x86:

  <PropertyGroup>     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>     <Platform Condition=" '$(Platform)' == '' ">x86</Platform> 

Also consider the case where the Solution still has the x86 configuration in Configuration Manager. I've found for some complex Solutions with multiple projects that have different configurations I have to spend a lot of time in Configuration Manager getting everything straight.

like image 164
user7116 Avatar answered Oct 11 '22 12:10

user7116