简体   繁体   English

VS2012驱动程序包在x64中使用了错误的输出目录

[英]VS2012 driver package using wrong output directory in x64

This appears to be a bug in VS2012 but I'm wondering if anyone has a workaround or can explain what's wrong. 这似乎是VS2012中的错误,但我想知道是否有人有解决方法或可以解释问题所在。 I followed this page for creating a simple KMDF driver in vs2012 here . 我跟着这个网页创建在vs2012简单KMDF驱动程序在这里 Before building, I set the output directory for the driver package project to "$(SolutionDir)Output\\$(ConfigurationName)\\", the main difference being the addition of "Output" to the path. 在构建之前,我将驱动程序包项目的输出目录设置为“ $(SolutionDir)Output \\ $(ConfigurationName)\\”,主要区别是在路径中添加了“ Output”。

When I build targeting Win32 it works fine, everything goes where I expect it to. 当我针对Win32进行构建时,它可以正常工作,一切都按我的预期进行。 However, when I build targeting x64, the output goes to "$(SolutionDir)$(ConfigurationName)\\" instead. 但是,当我针对x64进行构建时,输出将改为“ $(SolutionDir)$(ConfigurationName)\\”。 No matter what I enter for the output directory, it always starts at the SolutionDir. 无论我输入什么输出目录,它总是从SolutionDir开始。

When I'm selecting the Output Directory, if I click on Macros, I can see that OutDir is where the output is actually going, it does not match what I have specified for "Output Directory" in the project properties. 当我选择“输出目录”时,如果单击“宏”,则可以看到OutDir是输出实际去向的地方,它与我在项目属性中为“输出目录”指定的内容不匹配。 Is there something else that is overriding OutDir? 还有其他东西可以覆盖OutDir吗? I've tried setting OutDir in the .vcxproj file but it still behaves the same. 我尝试在.vcxproj文件中设置OutDir,但其行为仍然相同。

For anyone who is having this issue; 对于遇到此问题的任何人; I have found a fix for myself. 我已经找到适合自己的解决方案。

You'll need to manually edit the project file (.vcxproj file). 您需要手动编辑项目文件(.vcxproj文件)。

You'll find this line: 您会发现以下行:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

Move the property group that contains the OutDir definition right below that line, as in the following: 将包含OutDir定义的属性组移到该行的正下方,如下所示:

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Label="Globals">
    <OutDir>$(SolutionDir)outbin\$(Configuration)\$(Platform)\</OutDir>
    <OutputPath>$(SolutionDir)outbin\$(Configuration)\$(Platform)</OutputPath>
</PropertyGroup>

On my setup, the Microsoft.Cpp.props is overwritting those paths, so I need that to be included first, then overwrite what is configured in there. 在我的设置中,Microsoft.Cpp.props覆盖了这些路径,因此我需要先将其包括在内,然后覆盖其中的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM