Visual Studio 中 x86 和 x64 之间的自定义构建步骤路径 [英] Custom Build Step Paths Between x86 and x64 in Visual Studio
问题描述
作为参考,我使用的是 Visual Studio 2010.
For reference, I'm using Visual Studio 2010.
我有一个自定义构建步骤,定义如下:
I have a custom build step defined as follows:
if exist "$(TargetDir)"server.dll copy "$(TargetDir)"server.dll "c:\program files (x86)\myapp\server.dll"
这在我运行 64 位 Windows 的桌面上效果很好.但是,当我在笔记本电脑上构建时,c:\Program Files (x86)\ 不存在,因为它运行的是 32 位 Windows.我想加入一些可以在两个版本的 Windows 之间工作的东西,因为项目文件受版本控制,每次我在笔记本电脑上工作时改变路径真的很痛苦.
This works great on my desktop, which is running 64-bit Windows. However, when I build on my laptop, c:\Program Files (x86)\ doesn't exist because it's running 32-bit Windows. I'd like to put in something that will work between both editions of Windows, since the project files are under version control and it's a real pain to change the paths every time I work on my laptop.
如果这是一个 *nix 环境,我只会创建一个符号链接并完成它.有什么想法吗?
If this were a *nix environment I'd just create a symlink and be done with it. Any ideas?
推荐答案
你可以把它放在你的项目文件中:
You can put this in your project file:
<PropertyGroup>
<ProgramFiles32 Condition="Exists('$(PROGRAMFILES) (x86)')">$(PROGRAMFILES) (x86)</ProgramFiles32>
<ProgramFiles32 Condition="$(ProgramFiles32) == ''">$(PROGRAMFILES)</ProgramFiles32>
</PropertyGroup>
然后您可以在后期构建事件中使用 $(ProgramFiles32)
.
And then you can use $(ProgramFiles32)
in your post build event.
有关详细信息,请查看此 stackoverflow 问题.
For more information check this stackoverflow question.
这篇关于Visual Studio 中 x86 和 x64 之间的自定义构建步骤路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!