简体   繁体   English

如何使VS 2010默认创建x64项目?

[英]How To make VS 2010 create x64 projects as default?

I have a full x64 solution and each time I create a project it is by default an x86 project and I have to witch it manually to x64. 我有一个完整的x64解决方案,每次创建一个项目时,默认情况下它都是一个x86项目,因此我必须手动将其转换为x64。 Is there a way to have this by default ? 有没有默认的方法?

In C# .NET project and solution the default target platform should be "any CPU" and not x86, this means that the compiled IL is capable to run on a classic x86 and x64 system without any changes and in native mode ... 在C#.NET项目和解决方案中,默认目标平台应为“任何CPU”而不是x86,这意味着编译后的IL可以在经典x86和x64系统上运行,而无需进行任何更改并且可以在纯模式下运行。

Edit 编辑

Sorry i just noticed that the behaviour is changed in visual studio 2010, take a look here for further information on why this choice ... 抱歉,我刚刚注意到Visual Studio 2010中的行为已更改,请在此处查看有关为何选择此选项的更多信息...

So how is Visual Studio 2010 and .NET 4.0 changing? 那么,Visual Studio 2010和.NET 4.0会如何变化? We are not changing anything here in the CLR or compilers - they continue to support both modes. 我们不会在CLR或编译器中更改任何内容-它们继续支持两种模式。 However, after discussing these issues, VS project system team has agreed to make EXE projects default to the x86 platform in VS 2010. 但是,在讨论了这些问题之后,VS项目系统团队同意将EXE项目默认设置为VS 2010中的x86平台。

You can simply modify the project template. 您可以简单地修改项目模板。 For example, the project template for a WPF application is stored in C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ProjectTemplatesCache\\CSharp\\Windows\\1033\\WPFApplication.zip 例如,WPF应用程序的项目模板存储在C:\\ Program Files(x86)\\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ ProjectTemplatesCache \\ CSharp \\ Windows \\ 1033 \\ WPFApplication.zip

Open the .csproj file in that .zip file with a text editor and modify the <Platform> element from x86 to AnyCPU. 使用文本编辑器打开该.zip文件中的.csproj文件,然后将<Platform>元素从x86修改为AnyCPU。 Make a backup copy first. 首先制作备份副本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM