我在Visual Studio 2013中有一个C ++ / CLI dll项目,我试图更改输出目录。我已经设置了"输出目录"在项目属性中设置>一般到$(SolutionDir)Stage\$(Configuration)\bin$(PlatformArchitecture)\
。我可以看到,在vcxproj文件中,这会反映到OutDir:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)Stage\$(Configuration)\bin$(PlatformArchitecture)\</OutDir>
</PropertyGroup>
但是,它实际上似乎并未使用。在链接器下&gt;一般&gt;输出文件的默认值为$(OutDir)$(TargetName)$(TargetExt)
,但在命令行下看到的$(OutDir)
的扩展值并未反映我所做的更改,而是似乎具有值$(SolutionDir)Stage\$(ConfigurationName)
($(ConfigurationName)
是例如&#34; Debug_x64&#34;)。这很奇怪,因为vcxproj文件中没有...
如果要使输出目录中的更改影响$(OutDir)
,我需要做什么?我还注意到有一个宏$(OutDirWasSpecified)
,其值为false ...
答案 0 :(得分:2)
我认为$(OutDir)
通常设置在文件中:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.default.props
或者,如果是在32位平台上:
...\Win32\Microsoft.Cpp.Win32.default.props
通常,您可以在项目文件中找到:
MyProject.vcxproj
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
如果找到Microsoft.Cpp.Default.props
文件,则会有:
<!-- Allow platforms to define the defaults first -->
<Import Condition="Exists('$(VCTargetsPath)\Platforms\$(Platform)\Microsoft.Cpp.$(Platform).default.props')" Project="$(VCTargetsPath)\Platforms\$(Platform)\Microsoft.Cpp.$(Platform).default.props"/>
引入$OutDir
的地方。
似乎这个包含链在某种程度上被破坏了,或$(OutDir)
的原始定义在文件Microsoft.Cpp.x64.default.props
中被删除/修改。
答案 1 :(得分:0)
对于它的价值,我的Visual Studio 2013配置有点不同。我有一个根文件夹C:\Program Files (x86)\MSBuild\Microsoft.Cpp
,其下面是两个子文件夹,C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110
和C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
。