I have a strange problem, and hopefully someone can help me.
我有一个奇怪的问题,希望有人可以帮助我。
I have a solution with 13 separate C# projects. I am using Vista x64 to develop on, and I would like to build these projects to target the x86 platform. This is normally quite easy. I can go to solution properties -> Configuration properties and change the platform to x86. The strange part here is that 3 of my projects refuse to allow me to select x86.
我有一个包含13个独立C#项目的解决方案。我正在使用Vista x64进行开发,我想构建这些项目以针对x86平台。这通常很容易。我可以转到解决方案属性 - >配置属性并将平台更改为x86。这里奇怪的部分是我的3个项目拒绝让我选择x86。
So, I thought I'd go to each of these 3 projects separately and change it in Project Properties->Build and change the Platform. And the Configuration and Platform dropdowns are not there for these projects. I googled around a bit, and found a setting in Tools->Options->Projects And Solutions->Show Advanced build configuration. After selecting this, when going to Project Properties for the offending projects, I now see both dropdowns, but the platform only lets me select Active (Any CPU).
所以,我想我会分别去这三个项目中的每一个,并在Project Properties-> Build中更改它并更改Platform。并且这些项目没有配置和平台下拉列表。我google了一下,在Tools-> Options-> Projects And Solutions-> Show Advanced build configuration中找到了一个设置。选择此项后,当进入违规项目的项目属性时,我现在看到两个下拉列表,但平台只允许我选择活动(任何CPU)。
I can also not change the Platform in Solution properties to x86 for these projects.
对于这些项目,我也无法将解决方案属性中的平台更改为x86。
Any ideas?
4 个解决方案
#1
Sounds like the Build Configurations have gone screwy. The three projects were probably added after the solution was configured to have x86 support (New projects only support AnyCPU, even if the solution supports more platforms.)
听起来像构建配置已经搞砸了。在将解决方案配置为支持x86之后,可能会添加这三个项目(新项目仅支持AnyCPU,即使该解决方案支持更多平台。)
- Go Build->Configuration Manager...
- Change 'Active Solution Platform' to x86 (if it's there. If only AnyCPU is there, then use that.)
- For each offending project, in the Platform column, select 'New'
- Choose New Platform as 'x86', Copy Settings from 'Any CPU', and make sure the check box is NOT ticked.
- Hit OK.
Go Build-> Configuration Manager ...
将“Active Solution Platform”更改为x86(如果它在那里。如果只有AnyCPU,那么使用它。)
对于每个违规项目,在“平台”列中,选择“新建”
选择New Platform作为'x86',从'Any CPU'复制设置,并确保未勾选复选框。
Getting configuration/platforms consistent between the solution and individual projects can be tricky. The Configuration Manager can behave unexpectedly - especially with custom solution configurations. I suggest playing in a test solution first.
在解决方案和单个项目之间获得一致的配置/平台可能会非常棘手。 Configuration Manager可能会出现意外行为 - 尤其是使用自定义解决方案配置时。我建议先在测试解决方案中玩。
#2
I also develop on x64 and deploy to x86. However I don't change the platform from the default value (Any CPU) and it works for me just fine. Do you have any code (such as Win interop) that works differently across platforms? Check out this post by Hanselman for details on 32/64 bit .NET targeting.
我也在x64上开发并部署到x86。但是我没有从默认值(任何CPU)更改平台,它对我来说很好。您是否有任何代码(例如Win interop)在不同平台上的工作方式不同?有关32/64位.NET目标的详细信息,请查看Hanselman的这篇文章。
#3
I would compare the textual contents of the csproj files to see if there is any setting that has fallen out or in by accident. Also check the contents of the sln, maybe there's something weird with the configs.
我会比较csproj文件的文本内容,看看是否有任何设置已经失败或意外。还要检查sln的内容,也许有一些奇怪的配置。
Regards,
Sebastiaan
#4
For Visual Studio 2010. To run Access 12.0: R-click on the project name in Solution Explorer, select Properties - Build* - target platform - x86.
对于Visual Studio 2010.要运行Access 12.0:在解决方案资源管理器中单击项目名称,选择属性 - 构建* - 目标平台 - x86。
#1
Sounds like the Build Configurations have gone screwy. The three projects were probably added after the solution was configured to have x86 support (New projects only support AnyCPU, even if the solution supports more platforms.)
听起来像构建配置已经搞砸了。在将解决方案配置为支持x86之后,可能会添加这三个项目(新项目仅支持AnyCPU,即使该解决方案支持更多平台。)
- Go Build->Configuration Manager...
- Change 'Active Solution Platform' to x86 (if it's there. If only AnyCPU is there, then use that.)
- For each offending project, in the Platform column, select 'New'
- Choose New Platform as 'x86', Copy Settings from 'Any CPU', and make sure the check box is NOT ticked.
- Hit OK.
Go Build-> Configuration Manager ...
将“Active Solution Platform”更改为x86(如果它在那里。如果只有AnyCPU,那么使用它。)
对于每个违规项目,在“平台”列中,选择“新建”
选择New Platform作为'x86',从'Any CPU'复制设置,并确保未勾选复选框。
Getting configuration/platforms consistent between the solution and individual projects can be tricky. The Configuration Manager can behave unexpectedly - especially with custom solution configurations. I suggest playing in a test solution first.
在解决方案和单个项目之间获得一致的配置/平台可能会非常棘手。 Configuration Manager可能会出现意外行为 - 尤其是使用自定义解决方案配置时。我建议先在测试解决方案中玩。
#2
I also develop on x64 and deploy to x86. However I don't change the platform from the default value (Any CPU) and it works for me just fine. Do you have any code (such as Win interop) that works differently across platforms? Check out this post by Hanselman for details on 32/64 bit .NET targeting.
我也在x64上开发并部署到x86。但是我没有从默认值(任何CPU)更改平台,它对我来说很好。您是否有任何代码(例如Win interop)在不同平台上的工作方式不同?有关32/64位.NET目标的详细信息,请查看Hanselman的这篇文章。
#3
I would compare the textual contents of the csproj files to see if there is any setting that has fallen out or in by accident. Also check the contents of the sln, maybe there's something weird with the configs.
我会比较csproj文件的文本内容,看看是否有任何设置已经失败或意外。还要检查sln的内容,也许有一些奇怪的配置。
Regards,
Sebastiaan
#4
For Visual Studio 2010. To run Access 12.0: R-click on the project name in Solution Explorer, select Properties - Build* - target platform - x86.
对于Visual Studio 2010.要运行Access 12.0:在解决方案资源管理器中单击项目名称,选择属性 - 构建* - 目标平台 - x86。