【问题标题】:Message task for xbuild in xamarin?xamarin中xbuild的消息任务?
【发布时间】:2016-11-02 09:58:07
【问题描述】:

我正在尝试使用 Xamarin 中的 xbuild 实现持续集成。我知道 xbuild 使用 .csproj 文件来编译应用程序。我想从 csproj 文件中打印变量“IpaPackagePath”和“OutputPath”的值。我认为(?)xbuild 将类似于 msbuild。在 msbuild 中,打印值的方法是使用 Message 任务 以下是文件的部分

    <PropertyGroup>
           <CreateIpaDependsOn>
           $(CreateIpaDependsOn);
            DisplayMessages
           </CreateIpaDependsOn>
    </PropertyGroup>
    <Target Name="DisplayMessages">
        <Message Text="IPAPACKAGEPATH = $(IpaPackagePath)" />
        <Message Text="OUTPUTPATH = $(OutputPath)" />
    </Target>

    <Target Name="CopyIpa"
        Condition="'$(OutputType)' == 'Exe'
            And '$(ComputedPlatform)' == 'iPhone'
            And '$(BuildIpa)' == 'true'">
        <Copy
            SourceFiles="$(IpaPackagePath)"
            DestinationFolder="$(OutputPath)"/>    
    </Target>

我没有发现控制台上打印的任何消息或执行的任何目标名称“DisplayMessages”。 我做错了什么?

或者有什么方法可以打印xbuild中的变量值吗?

【问题讨论】:

    标签: xamarin msbuild xamarin.ios continuous-integration xbuild


    【解决方案1】:

    我在xbuild 中使用Message Text(以及msbuild 的OS-X 版本)。

    确保您的/verbosity: 至少设置为minimal,因为quiet 将抑制Message Text 输出。

    使用示例:

    xbuild /p:SolutionDir=~/ /target:VIEWENV Droid/Realm080.Droid.csproj
    

    目标示例:

    <!--    PlayScript   -->
    <Target Name="VIEWENV" DependsOnTargets="BeforeResolveReferences">
        <Message Text="                          CscToolExe: $(CscToolExe) "/>
        <Message Text="                         CscToolPath: $(CscToolPath) "/>
        <Message Text="                       ReferencePath: $(ReferencePath) "/>
        <Message Text="                           ToolsPath: $(ToolsPath) "/>
        <Message Text="            TargetFrameworkDirectory: $(TargetFrameworkDirectory) "/>
    ~~~
    </Target>
    

    注意:存在于您的.csproj 中引用的.target 文件中或直接包含在.csproj 中:

    示例输出:

    VIEWENV:
                                CscToolExe: mcs.exe
                               CscToolPath:
                             ReferencePath:
                                 ToolsPath:
    

    【讨论】:

    • 我需要在哪里设置 '/verbosity' 选项?
    • xbuild /verbosity:XXXXX 级别为安静、最小、正常、详细、诊断
    • 它会显示在输出中,即使你有详细的安静。
    猜你喜欢
    • 1970-01-01
    • 2016-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多