How to run a c++ function using MSBuild targets?

76 Views Asked by At

I am using MSBuild and I came across this topic called Targets that lets you perform some tasks before building the project.

I need to run a C++ function which is present in a .cpp file in my (.sln) solution file. I came across this example to run a task, but it is written in C#.

using System;
using Microsoft.Build.Utilities;

namespace SimpleTask1
{
    public class SimpleTask1: Task
    {
        public override bool Execute()
        {
            // This is where the task would presumably do its work.
            return true;
        }
    }
}

So basically, I want run a C++ function before the building my solution file and I am confused on how to use MSBuild tasks and targets for this purpose. This C++ function actually generates some code that is necessary for successful building, else the build would fail.

0

There are 0 best solutions below