Skip to content

Commit

Permalink
MSBuild: ensure to consume props files generated by MSBuildToolchain …
Browse files Browse the repository at this point in the history
…& MSBuildDeps with highest precedence
  • Loading branch information
SpaceIm committed Dec 31, 2022
1 parent b560c75 commit 7a60623
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions conan/tools/microsoft/msbuild.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from conans.errors import ConanException


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

props_paths = []
for props_file in ("conantoolchain.props", "conandeps.props"):
props_path = os.path.join(self._conanfile.generators_folder, props_file)
if os.path.exists(props_path):
props_paths.append(props_path)
if props_paths:
props_paths = ";".join(props_paths)
cmd += f" /p:ForceImportBeforeCppTargets=\"{props_paths}\""

return cmd

def build(self, sln, targets=None):
Expand Down

0 comments on commit 7a60623

Please sign in to comment.