久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

確定 MSBuild CoreCompile 是否將運行并調用自定義目

Determine if MSBuild CoreCompile will run and call custom target(確定 MSBuild CoreCompile 是否將運行并調用自定義目標)
本文介紹了確定 MSBuild CoreCompile 是否將運行并調用自定義目標的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

這似乎是一件顯而易見的事情,但我已經竭盡全力試圖在網上找到任何示例或自己做.

This seems like an obvious thing to want to do but I have pulled most of my hair out trying to find any examples on the web or do it myself.

我有一個包含 19 個項目的 c# 解決方案和一個運行構建腳本來驅動 MSBuild 的 Jenkins 構建服務器.MSBuild 當然會根據輸入與輸出來確定需要編譯和不需要編譯的內容.

I have a c# solution with 19 projects and a Jenkins build server running a build script to drive MSBuild. MSBuild will of course determine what does and does not need to be compiled based on inputs versus outputs.

我正在嘗試創建一個自定義目標,以有條件地更新 MSBuild 將要編譯的那些項目的 AssemblyInfo.cs 以增加文件版本.當然,我不想讓項目單獨編譯.

I am trying to create a custom target to conditionally update the AssemblyInfo.cs of those projects MSBuild is going to compile to increment the file versions. Of course I want to leave the projects not being compiled alone.

我知道如何在每次運行的 CoreBuild 之前注入一個目標,所以如果有一些變量,我可以測試看看是否會發生可以工作的編譯.我也知道如何確定編譯是否運行,因此有條件地進行一些可能但不理想的后處理.

I know how to inject a target prior to the CoreBuild that runs every time so if there is some variable I can test to see if a compile will occur that can work. I also know how to determine if a compile ran and therefore conditionally do some post processing which is possible but not ideal.

如何調整我的構建過程來實現這一點?

How can I tweak my build process to achieve this?

由于這個問題似乎沒有直接的答案,有誰知道如何執行與 MSBuild 相同的邏輯來確定哪些項目需要重建?

Since it seems there's no straight answer to the question, does anyone know how to perform the same logic as MSBuild to determine what projects require a rebuild?

推薦答案

最終解決方案是結合 Sayed Ibrahim Hashimi 的博客條目 和來自 MSDN 論壇條目的信息 '當(核心)編譯將執行時執行目標'.

In the end the solution was a combination of Sayed Ibrahim Hashimi's blog entry and information from the MSDN Forum entry 'Execute target when (core)compile will execute'.

我基本上采用了 Sayed 的注入方法來讓我的目標在所有項目上運行extend-corecompile.proj",而無需編輯每個 proj 文件,但將其內容替換為指向自定義目標的CoreCompileDependsOn"覆蓋采用與CoreCompile"目標相同的輸入和輸出.最終結果是一個僅在CoreCompile"運行且在構建腳本中集中管理時運行的目標.

I basically took Sayed's injection method to get my target to run 'extend-corecompile.proj' on all projects without having to edit each proj file but replaced it's contents with an override for 'CoreCompileDependsOn' that points to a custom target that adopts the same inputs and outputs as the 'CoreCompile' target. The end result is a target that only runs when 'CoreCompile' will run while being centrally managed in the build script.

感謝大家的投入,這是我在extend-corecompile.proj"中使用的框架代碼:

Thanks to all for their input and here is the skeleton code I used in 'extend-corecompile.proj':

<!--The following property group adds our custom post-target to the post compile call list -->
<PropertyGroup>
    <TargetsTriggeredByCompilation>
        $(TargetsTriggeredByCompilation);
        CustomPostTarget
    </TargetsTriggeredByCompilation>
</PropertyGroup>

<!--The following property group adds our custom pre-target to CoreCompileDependsOn to ensure it is called before CoreCompile -->
<PropertyGroup>
    <CoreCompileDependsOn>
        $(CoreCompileDependsOn);
        CustomPreTarget
    </CoreCompileDependsOn>
</PropertyGroup>

<!-- The following custom pre-target has the same inputs and outputs as CoreCompile so that it will only run when CoreCompile runs.
    Because we have injected this file and Targets are resolved in sequence we know this Target will fire before CoreCompile.-->
<Target Name="CustomPreTarget" 
    Inputs="$(MSBuildAllProjects);
            @(Compile);                               
            @(_CoreCompileResourceInputs);
            $(ApplicationIcon);
            $(AssemblyOriginatorKeyFile);
            @(ReferencePath);
            @(CompiledLicenseFile);
            @(EmbeddedDocumentation); 
            $(Win32Resource);
            $(Win32Manifest);
            @(CustomAdditionalCompileInputs)"
    Outputs="@(DocFileItem);
             @(IntermediateAssembly);
             @(_DebugSymbolsIntermediatePath);                 
             $(NonExistentFile);
             @(CustomAdditionalCompileOutputs)">
    <!--Do pre-compilation processing here-->
</Target>

<!--This target will be called by CoreCompile-->
<Target Name="CustomPostTarget" >
    <!--Do post-compilation processing here-->
</Target>

不確定如果 CoreCompile 失敗會發生什么,它仍然調用我們的目標嗎?我想我們會及時發現:)

Not sure what will happen if CoreCompile fails, does it still call our target? I guess in time we'll find out :)

這篇關于確定 MSBuild CoreCompile 是否將運行并調用自定義目標的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Is there a C# library that will perform the Excel NORMINV function?(是否有執行 Excel NORMINV 函數的 C# 庫?)
Select x random elements from a weighted list in C# (without replacement)(從 C# 中的加權列表中選擇 x 個隨機元素(無需替換))
Create a summary description of a schedule given a list of shifts(給定輪班列表,創建時間表的摘要描述)
C# Normal Random Number(C# 普通隨機數)
Standard deviation of generic list?(通用列表的標準偏差?)
AsyncCTP: Creating a class that is IAwaitable(AsyncCTP:創建一個 IAwaitable 的類)
主站蜘蛛池模板: 国产一区二区三区在线免费 | 一级做a爰片性色毛片16 | 中文字幕91av | www.青娱乐| 无人区国产成人久久三区 | 在线看日韩 | 亚洲欧美日韩系列 | 午夜三级视频 | 九九亚洲 | 久久久久久久久久久一区二区 | 亚洲精品91| 欧美一级三级 | jav成人av免费播放 | 国产精品99999999 | 自拍视频网 | 久久久久久精 | 99视频在线 | 91精品国产一区二区三区 | 成人免费毛片片v | 欧美激情欧美激情在线五月 | 国产精品久久久久一区二区三区 | 成人午夜影院 | 精品一区二区电影 | 精品国产精品三级精品av网址 | 精品视频在线免费观看 | 亚洲免费精品 | 午夜影院在线观看 | 亚洲视频免费在线观看 | 久久精品aaa | 日韩午夜电影在线观看 | 91在线电影 | 九九久久免费视频 | 午夜天堂精品久久久久 | 99精品视频免费在线观看 | 成人啊啊啊| 精品在线一区二区三区 | 中国黄色在线视频 | 欧美一级欧美三级在线观看 | 欧美video | 一级片在线视频 | 国产资源网 |