I have the following Directory.Build.props
files:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-14.2</LibraryPath>
<IncludePath>$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LibraryPath>$(BOOST_ROOT)\lib64-msvc-14.2</LibraryPath>
<IncludePath>$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(BOOST_ROOT)\lib32-msvc-14.2</LibraryPath>
<IncludePath>$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(BOOST_ROOT)\lib64-msvc-14.2</LibraryPath>
<IncludePath>$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
</Project>
Whenever I load a (C++) project in a subfolder (in visual Studio 2019), the project loses all inherited include and library paths:
I was thinking this might be due to me not appending to IncludePath
and LibraryPath
, so I did that and changed the props
files as follow:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(LibraryPath);$(BOOST_ROOT)\lib32-msvc-14.2</LibraryPath>
<IncludePath>$(IncludePath);$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LibraryPath>$(LibraryPath);$(BOOST_ROOT)\lib64-msvc-14.2</LibraryPath>
<IncludePath>$(IncludePath);$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(LibraryPath);$(BOOST_ROOT)\lib32-msvc-14.2</LibraryPath>
<IncludePath>$(IncludePath);$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LibraryPath>$(LibraryPath);$(BOOST_ROOT)\lib64-msvc-14.2</LibraryPath>
<IncludePath>$(IncludePath);$(BOOST_ROOT)\</IncludePath>
</PropertyGroup>
</Project>
Then reloading the project, results in missing inherited values, again.
I double checked to see if the macros are present, and they are (VC_
and WindowsSDK_
macros):
I also tried changing Directory.Build.props
to Directory.Build.targets
to make it load after the projects have been loaded, but then the file does not get loaded at all.
How can I make sure that my Directory.Build.props
inherits the default values, and appends my custom options?
The reason I want to do this is because I'm migrating away from the deprecated Microsoft.Cpp.Win32.user.props
file.
Changing the extention to .targets
works only for the build process, but intellisense / visual Studio doesn't pick up on the include files, and shows a lot of error (before compilation). This is not preferable.