活动解决方案平台VS Project Platform VS Platform目标

时间:2022-09-01 09:51:30

I want my application to be build for x64 (because i'm using x64 dlls). In configuration manager I've set "Active solution platform" to "x64" However in the projects list Platform is set to "x86". "Platform target" in project properties is also set to "x86"

我希望我的应用程序是为x64构建的(因为我正在使用x64 dll)。在配置管理器中,我将“Active solution platform”设置为“x64”但是在项目列表Platform中设置为“x86”。项目属性中的“平台目标”也设置为“x86”

I totally confused there are three places to set target platform:

我完全糊涂了设置目标平台的三个地方:

  • Configuration manager: Active solution platform
  • 配置管理器:活动解决方案平台
  • Configuration manager: Project platform
  • 配置管理器:项目平台
  • Project properties: Platform target
  • 项目属性:平台目标

For example I can set Active solution platform to x64, Project platform to x86 and Project target to x64. What will that mean?

例如,我可以将Active解决方案平台设置为x64,将Project平台设置为x86,将Project target设置为x64。那意味着什么?

Do someone can describe what exactly each of these options mean and how they supposed to be used together? How to compile to x64?

有人可以描述这些选项究竟是什么意思以及它们应该如何一起使用?如何编译到x64?

1 个解决方案

#1


22  

The Active Solution Platform allows you to configure a specific combination of configurations for each project. The Project Platform allows you to make specific configuration settings for a project. These two settings do not actually tell anything about which platform the solution and projects are going to be built with, it's just a configuration set that you can change the actual settings for.

Active Solution Platform允许您为每个项目配置特定的配置组合。 Project Platform允许您为项目进行特定的配置设置。这两个设置实际上并没有说明解决方案和项目将在哪个平台上构建,它只是一个配置集,您可以更改其实际设置。

By default, the x64 setting sets the project to be compiled specifically for x64, but that's changeable in the project properties via the project Platform Target property (though it would be very confusing to change the target for an existing configuration set to be anything else than its name).

默认情况下,x64设置将项目设置为专门为x64编译,但是可以通过项目Platform Target属性在项目属性中更改(尽管将现有配置集的目标更改为除此之外的任何其他内容都会非常混乱其名称)。

Each project's Platform Target property is the setting that's used to tell which platform the project assembly is compiled for. A setting of AnyCPU is the recommended setting if that project does not have any dependencies on components that require a specific platform to work.

每个项目的Platform Target属性都是用于指示项目程序集编译的平台的设置。如果该项目对需要特定平台工作的组件没有任何依赖性,则建议使用AnyCPU设置。

The AnyCPU setting will cause the assembly to be JIT:ed to

AnyCPU设置将导致程序集JIT:ed to

  • x86 on 32 bit platforms
  • 32位平台上的x86
  • x64 on 64 bit platforms
  • 64位平台上的x64

See this question for further information.

有关详细信息,请参阅此问题。

As for your example, setting Active solution platform to x64, Project platform to x86 and Project target to x64 would mean that when selecting that solution configuration the project assembly would be built to JIT only to 64 bit, causing an error if you tried to run it on a 32 bit platform.

至于您的示例,将Active平台设置为x64,将Project平台设置为x86,将Project target设置为x64意味着在选择该解决方案配置时,项目组件将仅构建为JIT到64位,如果您尝试运行则会导致错误它在32位平台上。

The x64 setting should be used if you have a dependency on a 64 bit only resource, such as a 64 bit dll. Correspondingly the x86 setting should be used if you have a dependency on a 32 bit only resource.

如果您依赖于仅64位资源(例如64位dll),则应使用x64设置。相应地,如果您依赖于仅32位资源,则应使用x86设置。

The configuration manager settings can be used to change the way you projects are built by for example use different referenced assemblies for x86/x64 or even for debug/release, like in this question. The configuration set are represented as variables that can be used inside the build configuration to control what to include and which build tasks to run for a specific configuration. Take a look inside a project file with notepad and you will see how it's used.

配置管理器设置可用于更改项目的构建方式,例如使用x86 / x64的不同引用程序集,甚至用于调试/发布,如此问题。配置集表示为可在构建配置中使用的变量,以控制要包含的内容以及为特定配置运行的构建任务。使用记事本查看项目文件,您将看到它是如何使用的。

#1


22  

The Active Solution Platform allows you to configure a specific combination of configurations for each project. The Project Platform allows you to make specific configuration settings for a project. These two settings do not actually tell anything about which platform the solution and projects are going to be built with, it's just a configuration set that you can change the actual settings for.

Active Solution Platform允许您为每个项目配置特定的配置组合。 Project Platform允许您为项目进行特定的配置设置。这两个设置实际上并没有说明解决方案和项目将在哪个平台上构建,它只是一个配置集,您可以更改其实际设置。

By default, the x64 setting sets the project to be compiled specifically for x64, but that's changeable in the project properties via the project Platform Target property (though it would be very confusing to change the target for an existing configuration set to be anything else than its name).

默认情况下,x64设置将项目设置为专门为x64编译,但是可以通过项目Platform Target属性在项目属性中更改(尽管将现有配置集的目标更改为除此之外的任何其他内容都会非常混乱其名称)。

Each project's Platform Target property is the setting that's used to tell which platform the project assembly is compiled for. A setting of AnyCPU is the recommended setting if that project does not have any dependencies on components that require a specific platform to work.

每个项目的Platform Target属性都是用于指示项目程序集编译的平台的设置。如果该项目对需要特定平台工作的组件没有任何依赖性,则建议使用AnyCPU设置。

The AnyCPU setting will cause the assembly to be JIT:ed to

AnyCPU设置将导致程序集JIT:ed to

  • x86 on 32 bit platforms
  • 32位平台上的x86
  • x64 on 64 bit platforms
  • 64位平台上的x64

See this question for further information.

有关详细信息,请参阅此问题。

As for your example, setting Active solution platform to x64, Project platform to x86 and Project target to x64 would mean that when selecting that solution configuration the project assembly would be built to JIT only to 64 bit, causing an error if you tried to run it on a 32 bit platform.

至于您的示例,将Active平台设置为x64,将Project平台设置为x86,将Project target设置为x64意味着在选择该解决方案配置时,项目组件将仅构建为JIT到64位,如果您尝试运行则会导致错误它在32位平台上。

The x64 setting should be used if you have a dependency on a 64 bit only resource, such as a 64 bit dll. Correspondingly the x86 setting should be used if you have a dependency on a 32 bit only resource.

如果您依赖于仅64位资源(例如64位dll),则应使用x64设置。相应地,如果您依赖于仅32位资源,则应使用x86设置。

The configuration manager settings can be used to change the way you projects are built by for example use different referenced assemblies for x86/x64 or even for debug/release, like in this question. The configuration set are represented as variables that can be used inside the build configuration to control what to include and which build tasks to run for a specific configuration. Take a look inside a project file with notepad and you will see how it's used.

配置管理器设置可用于更改项目的构建方式,例如使用x86 / x64的不同引用程序集,甚至用于调试/发布,如此问题。配置集表示为可在构建配置中使用的变量,以控制要包含的内容以及为特定配置运行的构建任务。使用记事本查看项目文件,您将看到它是如何使用的。