Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ $(OutDir)未设置为项目输出目录_C++_Visual Studio - Fatal编程技术网

C++ $(OutDir)未设置为项目输出目录

C++ $(OutDir)未设置为项目输出目录,c++,visual-studio,C++,Visual Studio,我在Visual Studio 2013中有一个C++/CLI dll项目,我正在尝试更改输出目录。我已将项目属性>常规中的“输出目录”设置设置为$(SolutionDir)阶段\$(配置)\bin$(平台架构)\。我可以看到,在vcxproj文件中,这反映到OutDir: <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LinkIncremental>true</

我在Visual Studio 2013中有一个C++/CLI dll项目,我正在尝试更改输出目录。我已将项目属性>常规中的“输出目录”设置设置为
$(SolutionDir)阶段\$(配置)\bin$(平台架构)\
。我可以看到,在vcxproj文件中,这反映到OutDir:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  <LinkIncremental>true</LinkIncremental>
  <OutDir>$(SolutionDir)Stage\$(Configuration)\bin$(PlatformArchitecture)\</OutDir>
</PropertyGroup>

真的
$(SolutionDir)阶段\$(配置)\bin$(平台架构)\
然而,它似乎并没有被实际使用。在Linker>General>Output File下,默认值是
$(OutDir)$(TargetName)$(targettext)
,但是在命令行下看到的
$(OutDir)
的扩展值并没有反映我所做的更改,而是似乎具有值
$(SolutionDir)Stage\$(ConfigurationName)
$(ConfigurationName)
)“Debug_x64”)。这是wierd,因为vcxproj文件中不存在该文件

我需要做什么才能使输出目录中的更改影响
$(OutDir)
?我还注意到有一个宏
$(outdirwassespecified)
,其值为false…

我相信
$(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" />
这就是引入
$OutDir
的地方


这条包含链似乎不知何故被破坏了,或者
$(OutDir)
的原始定义在文件
Microsoft.Cpp.x64.default.props

中被删除/修改了。值得一提的是,我的Visual Studio 2013配置有点不同。我有一个根文件夹
C:\Program Files(x86)\MSBuild\Microsoft.Cpp
,其下有两个子文件夹,
C:\ProgramFiles(x86)\MSBuild\Microsoft.Cpp\v4.0\V110
C:\ProgramFiles(x86)\MSBuild\Microsoft.Cpp\v4.0\V120

这些宏在您实际生成项目之前不会被扩展。因此,请使用build+build并在您的解决方案目录中查找Stage\Debug\u x64\binx64\foo.dll文件。请注意,CLR在那里找到它的希望很小。@HansPassant:我已经生成了项目,并且这些文件放置在错误的位置。我为这些程序集定制了程序集加载,因此CLR在查找它们时得到了一些帮助:)我将尝试提取该齿:它被复制到哪个目录?@HansPassant:
$(OutDir)
$(SolutionDir)Stage\$(ConfigurationName)的实际扩展值
,即
\Stage\Debug\u x64
。当然可以。再拉一次:它被复制到哪个目录?谢谢,如果我们搞砸了导入,我会看看
 <!-- 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"/>