Skip to content

Commit 7a60623

Browse files
committed
MSBuild: ensure to consume props files generated by MSBuildToolchain & MSBuildDeps with highest precedence
1 parent b560c75 commit 7a60623

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

conan/tools/microsoft/msbuild.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
from conans.errors import ConanException
24

35

@@ -46,6 +48,15 @@ def command(self, sln, targets=None):
4648
raise ConanException("targets argument should be a list")
4749
cmd += " /target:{}".format(";".join(targets))
4850

51+
props_paths = []
52+
for props_file in ("conantoolchain.props", "conandeps.props"):
53+
props_path = os.path.join(self._conanfile.generators_folder, props_file)
54+
if os.path.exists(props_path):
55+
props_paths.append(props_path)
56+
if props_paths:
57+
props_paths = ";".join(props_paths)
58+
cmd += f" /p:ForceImportBeforeCppTargets=\"{props_paths}\""
59+
4960
return cmd
5061

5162
def build(self, sln, targets=None):

0 commit comments

Comments
 (0)