如何从 FinalBuilder 调用 MSBuild 任务?

发布于 2024-10-06 05:06:55 字数 104 浏览 1 评论 0原文

我现在看到的唯一方法是为包含所需任务调用的 MSBuild 创建 xml 文件,然后通过调用“执行程序”操作直接运行 MSBuild。有没有使用 FinalBuilder 执行此操作的标准方法?

The only way I see now is to create xml file for MSBuild containing needed tasks invocations and then run MSBuild directly by calling "Execute Program" action. Is there any standard way of doing this using FinalBuilder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

比忠 2024-10-13 05:06:55

在 FinalBuilder 6 中,您可以使用 MSBuild 任务。然而,老实说,在我们的构建脚本中,我发现使用批处理文件和“执行程序”是更好的解决方案。

编辑:快速阅读有关此主题的内容,我现在记得为什么使用批处理文件。 FB6 MSBuild 操作有点违反直觉,因为并非所有属性都可以从“默认视图”访问,您需要更改为“属性网格”。

更新:来自您的评论;如果您想运行单独的 MSBuild 任务而不使用“执行程序”操作,那么您将需要创建自己的 FB 操作。我自己从未创建过自定义操作,但显然它们非常简单。

这是我使用的批处理文件:

@ECHO off
SET Action=%1
SET Configuration=%2
SET Platform=x86
SET CommonTools=%VS90COMNTOOLS%
SET SourceDir=%CD%\..\..
SET SolutionFilename=Solution.sln
SET MSBuild=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe

IF "%Action%" == "" SET Action=Rebuild
IF "%Configuration%" == "" SET Configuration=Release

:BUILD
%MSBuild% "%SourceDir%\%SolutionFilename%" /v:m /t:%Action% /p:Configuration=%Configuration% /p:DenEnvDir="%CommonTools%..\IDE\" /p:SolutionDir="%SourceDir%" /p:Platform=%Platform%

:END
ECHO.
ECHO ErrorLevel: %ERRORLEVEL%
EXIT /B %ERRORLEVEL%

In FinalBuilder 6 you can use a MSBuild Task. However to be honest in our build script I found that using a batch file and the 'Execute Program' to be a better solution.

Edit: Quickly doing some reading on this topic I now remember why I used a batch file. The FB6 MSBuild action is a little counterintuitive as not all the properties are accessible from the 'default view' and you need to change to the 'property grid'.

Update: From your comment; if you want to run an individual MSBuild task and not use the 'Execute Program' action then you will need to create your own FB action. I have never created an custom action myself but apparently they are really simple.

This is the batch file that I used:

@ECHO off
SET Action=%1
SET Configuration=%2
SET Platform=x86
SET CommonTools=%VS90COMNTOOLS%
SET SourceDir=%CD%\..\..
SET SolutionFilename=Solution.sln
SET MSBuild=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe

IF "%Action%" == "" SET Action=Rebuild
IF "%Configuration%" == "" SET Configuration=Release

:BUILD
%MSBuild% "%SourceDir%\%SolutionFilename%" /v:m /t:%Action% /p:Configuration=%Configuration% /p:DenEnvDir="%CommonTools%..\IDE\" /p:SolutionDir="%SourceDir%" /p:Platform=%Platform%

:END
ECHO.
ECHO ErrorLevel: %ERRORLEVEL%
EXIT /B %ERRORLEVEL%
分分钟 2024-10-13 05:06:55

您不能只从另一个应用程序中运行 msbuild 任务,而不实例化它所依赖的 msbuild 环境。您至少需要一个 msbuild 项目文件。

You cannot just run an msbuild task from within another application without instantiating the msbuild environment on which it depends. You will need an msbuild project file at the very least.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文