0

My VS2019 c++ project contains a custom file FileName.xyz, which I'm building using custom build command: MyTool.exe FileName.xyz Output: FileName.cpp

Now from C# project code, I want to programmatically build this C++ project using MSBuild.Execution()

MsBuild.Execution.BuildResult result = MsBuild.Execution.BuildManager.DefaultBuildManager.Build(buildParams, buildRequest);
                    if (result.OverallResult == MsBuild.Execution.BuildResultCode.Success)

This actually creates a enc_temp_folder and copies FileName.xyz file, but as .xyz file is unknown type returns success. this only works for 'ClCompile' type, but as my custom file FileName.xyz is defined as a CustomBuild item in .vcxproj file, it is not building. FileName.cpp is also defined as ClCompile item in vcxproj file.

I want to change above code to trigger pre build command: command: MyTool.exe FileName.xyz Output: FileName.cpp so that with generated FileName.cpp default build is performed.

I don't know how and what I need to change? I've found msbuild.execution.projecttaskinstance may help, but not seen any code example.

Peeyush
  • 31
  • 6

0 Answers0