Repository navigation
Conversation
memsharded
left a comment
There was a problem hiding this comment.
Thanks for the contribution @jdoubleu
It would be necessary to add some tests, I'd suggest a full "functional" test that completely demoes an injection of some .props file.
| return re.compile(r"[.+]").sub("_", name) | ||
|
|
||
| @staticmethod | ||
| def _module_path(path, name): |
There was a problem hiding this comment.
It seems this method is unused?
| <ImportGroup Label="PropertySheets"> | ||
| {% for mod in build_modules %} | ||
| <Import Condition="Exists('$(Conan{{name}}RootFolder)\{{mod}}')" Project="$(Conan{{name}}RootFolder)\{{mod}}"/> | ||
| {% endfor %} | ||
| </ImportGroup> |
There was a problem hiding this comment.
It would be better if possible to follow the pattern that other variables follow:
- Define the contents/value in the ```xxx-vars.props`` file in a new variable
- Use the variable here.
There was a problem hiding this comment.
When supporting multiple include files that's not possible, unfortunately. The property would need to hold a list of files. But MSBuild doesn't allow iterating over a property at all. The Import element doesn't support a list of files. It requires one element per file.
I think I'm going to drop support for multiple files and only allow a single file to be included.
There was a problem hiding this comment.
Sounds good, if users want to include multiple files, they can also Import those files in their added props file I guess.
|
Hi @jdoubleu Please let us know if you need some guidance or help with the tests or other aspects. Conan 2.35 is planned for end of the month, as usual, there is still time to get this PR into it. Thanks! |
Changelog: Feature: Allow injecting additional property sheets into MSBuildDeps generated files
Docs: conan-io/docs#4582
Implements the feature requested in #20423. The implementation is very simple, giving recipe authors great flexibility. As outlined in #20423, the most common use-case would be to include MSBuild/Visual Studio specific files, like
.natvisdebugger extensions.I'm also preparing a PR for the conan-center-index to utilize this feature in some, primarily Microsoft-related, recipes.
develop2branch, documenting this one.Discussion
I'm not sure about the naming of the
msbuild_import_propsproperty. I started withmsbuild_builds_modulesto align withCMakeDepsproperties but didn't find it fitting in the MSBuild context. The included files aren't necessarily limited to.propsfiles but would also accept.targetfiles.