为 x86 和 x64 平台构建项目目标 [英] Build project targeting for both x86 and x64 platform
问题描述
在我的解决方案中,有一个类库,它是一个 excel 插件.当我构建解决方案或那个项目时,我希望这个项目首先针对 x86 构建,输出一个名为 xxx.dll
的文件,然后针对 x64 构建一个名为 xxx_x64 的文件.dll
.
In my solution, there is a class library which is an excel add-in. When I build the solution or that project, I want this project will be built firstly targeting for x86 with outputing a file named xxx.dll
, and then targeting for x64 with outputing a file named xxx_x64.dll
.
我该怎么做,或者如何编辑 csproj 文件?谢谢.
How should I do for this, or how could I edit the csproj file? Thanks.
推荐答案
最后,我在 Visual Studio 中使用 Shared Project 解决了这个问题.我想要的是通过构建解决方案将生成两个 Excel Addin 程序集,一个针对 x86
平台或 AnyCPU
,另一个针对 x64
代码>平台.
Finally, I have solved this problem by using Shared Project in Visual Studio. What I want is two Excel Addin assemblies will be generated by building the solution, one is targeting to x86
platform or AnyCPU
, the other is targeting to x64
platform.
这是我的项目快照:
所有的代码文件(*.cs)和资源(图片或xml文件)都被移到了Shared项目中,另外两个项目都引用了它.
All the code files(*.cs) and resources(images or xml files) are moved into the Shared project, and both the other 2 projects have a reference to it.
至于其他两个项目,它们之间存在一些差异,例如程序集名称和目标平台.一个是XXX.dll
,针对AnyCPU
,另一个是XXX_64.dll
,针对x64
.
As to the other 2 projects, there are some differences between them, e.g. Assembly Name and Target Platform. One is XXX.dll
and targeting AnyCPU
, the other is XXX_64.dll
and targeting x64
.
在构建解决方案时,2个项目中的每一个都会发布相应的程序集.
When building the solution, each of the 2 projects will issue the corresponding assembly.
这篇关于为 x86 和 x64 平台构建项目目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!