0

我正在使用 MSBuild,并且遇到了一个名为 Targets 的主题,它允许您在构建项目之前执行一些任务。

我需要运行我的 (.sln) 解决方案文件中的 .cpp 文件中存在的C++函数。我遇到了这个示例来运行任务,但它是用 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;
        }
    }
}

所以基本上,我想在构建我的解决方案文件之前运行一个 C++ 函数,我对如何为此目的使用 MSBuild 任务和目标感到困惑。这个 C++ 函数实际上会生成一些成功构建所必需的代码,否则构建将失败。

4

0 回答 0