如何在Visual Studio项目中更改Build.Platform属性? [英] How can I change the Build.Platform property in a Visual Studio project?

查看:367
本文介绍了如何在Visual Studio项目中更改Build.Platform属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个非常大的解决方案中,许多项目之一都被设置为Build Platform == Active(x86).我希望它与所有其他项目(任何CPU")匹配.

One of the many projects in a very large solution somehow became set to Build Platform == Active (x86). I want it to match all of the other projects ("Any CPU").

我成功地将 Platform target 下拉列表从"Active(x86)"更改为"Any CPU",但是 Platform 下拉列表具有"Active(x86)"作为唯一的选择:

I successfully changed the Platform target dropdown from "Active (x86)" to "Any CPU", but the Platform dropdown has "Active (x86)" as the only option:

我不知道这个项目是如何与其他项目不同步"的,更重要的是如何使它与其他项目保持一致...

I don't know how this project got "out of sync" with the others as to this setting to begin with, and more importantly how to get it back in line with the others...

我认为问题可能出在我的VS安装设置为VB而不是C#(这是由IT完成的,这里的大多数猫都是VB开发人员).

I think the problem may have been that my VS install was set to VB instead of C# (it was done by IT, and most of the cats here are VB developers).

此: http://go4answers.webhost4life.com/Example/buildsolution-configuration-dropdown-188435.aspx 提到工具|设置,但是我没有这样的菜单项.

This: http://go4answers.webhost4life.com/Example/buildsolution-configuration-dropdown-188435.aspx mentions Tools | Settings, but I have no such menu item.

我确实选择了将设置重置为原始设置的选项,并且设置重置进行中"对话框现在已经快将近半小时了,并且显示为VS(无响应)"

I did select the option to reset settings to original, and the "Settings Reset in Progress" dialog has been churning away for nigh on to half an hour now, with VS "(Not Responding")

现在我在Windows CE项目中遇到了相反的问题-我需要它是"x86",并且它拒绝将其从任何CPU"更改为.

Now I'm having the opposite problem with a Windows CE project - I need it to be "x86" and it refuses to change to that from "Any CPU".

我要更改此设置的原因是,当尝试在手持设备上运行此应用程序时,我得到了找不到P/调用DLL sqlcemeNN.dll"错误信息.

The reason why I want to change this setting is because when trying to run this app on a handheld device I'm getting the "Can’t find P/Invoke DLL sqlcemeNN.dll" err msg.

根据:"如果您的计算机是64位设备,则可能已被困在默认目标平台任何CPU"陷阱中,请将目标平台设置为"x86" '.需要更多详细信息,请访问ErikEJ的博客文章."

我的计算机 是64位的,我确实读过所引用的博客文章

My machine is 64-bit, and I did read the blog post referenced

...但是我在Confriguration Manager的活动解决方案平台"下拉菜单中没有"x86"选项. 任何CPU"是它给我的唯一选择...

...but I have no "x86" option in my Confriguration Manager's "Active Solution Platform" dropdown. "Any CPU" is the only option it gives me...

输入后,我能够以某种方式强制"Active Solution Platform"下拉菜单说"x86",但我认为它并没有真正改变任何东西.在网格中,唯一的选择是任何CPU".从项目"列中选择编辑..."(没有新建...")仅在列表中显示任何CPU",一个变灰的删除"按钮和一个关闭按钮(灰色退出项目平台" .png)

I was able to somehow force the "Active Solution Platform" dropdown to say "x86" after typing that in, but I don't think it really changed anything. In the grid, the only option is "Any CPU". Selecting "Edit..." (there is no "New...") from the "Project" column just shows "Any CPU" in the list, a greyed-out "Remove" button, and a Close button ("greyedoutprojectplatforms.png")

所以我尝试的是将项目.csproj文件中的每个"Any CPU"实例都更改为"x86",并在Project> Properties> Build> Platform Target中仍然说"Any CPU"!

So what I tried is I changed every instance of "Any CPU" in the project's .csproj file to "x86" and STILL it says "Any CPU" in Project > Properties > Build > Platform Target!

推荐答案

尝试从解决方案文件向项目中添加新的生成配置(在Visual Studio中右键单击它,然后单击属性,然后转到 Configuration Manager >.

Try adding a new build configuration to your project from the solution file (right click it on Visual Studio, properties then go to Configuration Manager.

否则,您可以手动编辑项目文件(使用记事本打开* .csproj)并重新添加 AnyCpu 的规则

Otherwise you can manually edit the project file (open the *.csproj with notepad) and add back the rule for AnyCpu http://msdn.microsoft.com/en-us/library/ms734788(v=vs.85).aspx.

如果您在具有源代码控制和持续集成的团队中工作,则可能有人为了满足对构建服务器的要求而对其进行了更改. 可能最干净的方法是为您的项目添加自定义构建配置,然后在解决方案中使用该配置.

It is likely that if you're working in a team with source control and continuous integration, this has been changed by someone to satisfy a requirement on the build server. Probably the cleanest thing to do is add a custom build configuration for your project and use that one on your solution.

这篇关于如何在Visual Studio项目中更改Build.Platform属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆