pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

確定 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 的類)
主站蜘蛛池模板: 一体化预制泵站-一体化提升泵站-一体化泵站厂家-山东康威环保 | 恒温恒湿试验箱_高低温试验箱_恒温恒湿箱-东莞市高天试验设备有限公司 | 重庆网站建设,重庆网站设计,重庆网站制作,重庆seo,重庆做网站,重庆seo,重庆公众号运营,重庆小程序开发 | 税筹星_灵活用工平台_企业财务顾问_财税法薪综合服务平台 | 硬齿面减速机_厂家-山东安吉富传动设备股份有限公司 | 东莞办公家具厂家直销-美鑫【免费3D效果图】全国办公桌/会议桌定制 | 预制围墙_工程预制围墙_天津市瑞通建筑材料有限公司 | 日本SMC气缸接头-速度控制阀-日本三菱伺服电机-苏州禾力自动化科技有限公司 | LED显示屏_LED屏方案设计精准报价专业安装丨四川诺显科技 | 玻璃瓶厂家_酱菜瓶厂家_饮料瓶厂家_酒瓶厂家_玻璃杯厂家_徐州东明玻璃制品有限公司 | 扒渣机厂家_扒渣机价格_矿用扒渣机_铣挖机_撬毛台车_襄阳永力通扒渣机公司 | 铁素体测量仪/检测仪/铁素体含量测试仪-苏州圣光仪器有限公司 | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 雷冲击高压发生器-水内冷直流高压发生器-串联谐振分压器-武汉特高压电力科技有限公司 | IHDW_TOSOKU_NEMICON_EHDW系列电子手轮,HC1系列电子手轮-上海莆林电子设备有限公司 | 盐水蒸发器,水洗盐设备,冷凝结晶切片机,转鼓切片机,絮凝剂加药系统-无锡瑞司恩机械有限公司 | 猪I型/II型胶原-五克隆合剂-细胞冻存培养基-北京博蕾德科技发展有限公司 | 北京发电机出租_发电机租赁_北京发电机维修 - 河北腾伦发电机出租 | 软文发布平台 - 云软媒网络软文直编发布营销推广平台 | 恒温恒湿箱(药品/保健品/食品/半导体/细菌)-兰贝石(北京)科技有限公司 | 浙江皓格药业有限公司| 钢结构-钢结构厂房-钢结构工程[江苏海逵钢构厂] | 耐磨焊丝,堆焊焊丝,耐磨药芯焊丝,碳化钨焊丝-北京耐默公司 | 警方提醒:赣州约炮论坛真的安全吗?2025年新手必看的网络交友防坑指南 | 常州律师事务所_常州律所_常州律师-江苏乐天律师事务所 | 成都离婚律师|成都结婚律师|成都离婚财产分割律师|成都律师-成都离婚律师网 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | 经济师考试_2025中级经济师报名时间_报名入口_考试时间_华课网校经济师培训网站 | 青岛球场围网,青岛车间隔离网,青岛机器人围栏,青岛水源地围网,青岛围网,青岛隔离栅-青岛晟腾金属制品有限公司 | 色油机-色母机-失重|称重式混料机-称重机-米重机-拌料机-[东莞同锐机械]精密计量科技制造商 | 脉冲除尘器,除尘器厂家-淄博机械 | 无线遥控更衣吊篮_IC卡更衣吊篮_电动更衣吊篮配件_煤矿更衣吊篮-力得电子 | 玄米影院| 振动台-振动试验台-振动冲击台-广东剑乔试验设备有限公司 | 智能交通网_智能交通系统_ITS_交通监控_卫星导航_智能交通行业 | Duoguan 夺冠集团| 播音主持培训-中影人教育播音主持学苑「官网」-中国艺考界的贵族学校 | 卫生人才网-中国专业的医疗卫生医学人才网招聘网站! | 华禹护栏|锌钢护栏_阳台护栏_护栏厂家-华禹专注阳台护栏、楼梯栏杆、百叶窗、空调架、基坑护栏、道路护栏等锌钢护栏产品的生产销售。 | 我车网|我关心的汽车资讯_汽车图片_汽车生活! | 北京网站建设-企业网站建设-建站公司-做网站-北京良言多米网络公司 |