Skip to content

feat: add MSBuild rule to build MSBuild projects.#1443

Open
jsun-splunk wants to merge 2 commits intobazel-contrib:mainfrom
jsun-splunk:jsun-msbuild
Open

feat: add MSBuild rule to build MSBuild projects.#1443
jsun-splunk wants to merge 2 commits intobazel-contrib:mainfrom
jsun-splunk:jsun-msbuild

Conversation

@jsun-splunk
Copy link
Contributor

@jsun-splunk jsun-splunk commented Oct 20, 2025

This is an attempt to add a rule to build MSBuild project from bazel. This rule only supports MSBuild.exe from MSVC. dotnet msbuild is not supported.

MSBuild, aka Microsoft Build Engine is a platform for building applications. This engine provides an XML schema for a project file that controls how the build platform processes and builds software.

There are no source code to build from for MSBuild. There are also no prebuilt binaries that is available. Therefore, this rule is only availabe for pre-installed toolchain. This usually involves installing MSBuild along side MSVC.

MSBuild generates compile and link flags from project configuration and solution files. I have not been able to find a definitve way to override that so we can applied only the bazel generated flags. As a compromised, the generated bazel flags from cc_toolchain are added to a msbuild.props files and passed to MSBuild via the -p:ForceImportAfterCppTargets property. This at the minimum confirms bazel flags are applied.

@jsun-splunk jsun-splunk force-pushed the jsun-msbuild branch 16 times, most recently from 6dbc50d to cd48691 Compare October 27, 2025 00:32
@jsun-splunk jsun-splunk changed the title msbuild wip feat: add MSBuild rule to build MSBuild projects. Nov 4, 2025
@jsun-splunk jsun-splunk marked this pull request as ready for review November 4, 2025 03:58
@jsun-splunk jsun-splunk force-pushed the jsun-msbuild branch 4 times, most recently from d29e8e6 to 511adb0 Compare November 18, 2025 08:31
@matt-sm
Copy link
Contributor

matt-sm commented Nov 21, 2025

I'm trying to picture how deps would work eg. msbuild with dep for rfcc/cc_library

@jsun-splunk
Copy link
Contributor Author

I'm trying to picture how deps would work eg. msbuild with dep for rfcc/cc_library

wouldn't it be the same as other rules? i.e what you declare in out_shared_lib or out_static_lib become part of the CcInfo to be use downstream?

@matt-sm
Copy link
Contributor

matt-sm commented Dec 2, 2025

I'm trying to picture how deps would work eg. msbuild with dep for rfcc/cc_library

wouldn't it be the same as other rules? i.e what you declare in out_shared_lib or out_static_lib become part of the CcInfo to be use downstream?

I am thinking the other way - if msbuild had a dep on another ccinfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants