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

Visual Studio/MSBuild 將引用類庫的 app.config 作為 *.

Visual Studio/MSBuild copy referenced class library#39;s app.config as *.dll.config to bin folder of current project(Visual Studio/MSBuild 將引用類庫的 app.config 作為 *.dll.config 復(fù)制到當(dāng)前項(xiàng)目的 bin 文件夾) - IT屋-程序
本文介紹了Visual Studio/MSBuild 將引用類庫的 app.config 作為 *.dll.config 復(fù)制到當(dāng)前項(xiàng)目的 bin 文件夾的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個(gè)被許多其他 Web 應(yīng)用程序項(xiàng)目引用的類庫.它的 app.config 中有許多我希望在所有引用 Web 項(xiàng)目中使用的設(shè)置.構(gòu)建類庫時(shí),它會(huì)將 app.config 作為 .dll.config 復(fù)制到自己的 bin 文件夾中.

I have a class library that is referenced by many other web application projects. It has many settings in its app.config that I wish to use in all of the referencing web projects. When the class library is built, it copies the app.config to its own bin folder as <assembly.name>.dll.config.

  • 默認(rèn)情況下,Visual Studio/MSBuild 似乎不這樣做.
  • 更改 Copy to Output DirectoryBuild Action(任意組合)不起作用.
  • SlowCheetah VS 擴(kuò)展似乎可以做我想做的事情,這是其配置轉(zhuǎn)換過程的意外副作用,但我想這樣做 沒有任何第 3 方擴(kuò)展.
  • Visual Studio / MSBuild does not seem to do this by default.
  • Changing Copy to Output Directory or Build Action (in any combination) does not work.
  • SlowCheetah VS extension appears to do what I want as an unintended side-effect of its config transform process, but I want to do this without any 3rd-party extensions.

順便說一句:手動(dòng)將所有這些配置放入每個(gè) Web 應(yīng)用程序項(xiàng)目中是不切實(shí)際的.我可以通過在 bin 文件夾中查找 <assembly.name>.dll.config 來讀取文件,然后從那里提取設(shè)置.我已經(jīng)可以做到這一點(diǎn),所以這不是問題 - 我只需要確保文件可以在那里閱讀

As an aside: It's impractical to manually put all of this config in each of the web application projects. I can read the file by looking for <assembly.name>.dll.config in the bin folder, and extract the settings from there. I can already do this, so that's not an issue - I just need to ensure the file is going to be there for reading

推薦答案

這可以通過將以下內(nèi)容添加到類庫的項(xiàng)目文件 assembly.name.csproj 來實(shí)現(xiàn),無需 3rd-party 工具:

This can be achieved without 3rd-party tools by adding the following to the class library's project file, assembly.name.csproj:

// Find this <Import> element for Microsoft.CSharp.targets
<Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
// Add this <ItemGroup> element immediately after
<ItemGroup>
    <Content Include="app.config">
        <Link>$(TargetName).dll.config</Link>
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
</ItemGroup>

這會(huì)導(dǎo)致 app.config 被復(fù)制到將其作為 .dll.config 引用的任何項(xiàng)目.很好,因?yàn)槟阒恍枰渲靡粋€(gè).csproj文件,效果就級(jí)聯(lián)到所有引用的項(xiàng)目.

This causes the app.config to be copied to whichever project is referencing it as <assembly.name>.dll.config. It's good because you only need to configure the one .csproj file and the effect cascades out to all referencing projects.

這篇關(guān)于Visual Studio/MSBuild 將引用類庫的 app.config 作為 *.dll.config 復(fù)制到當(dāng)前項(xiàng)目的 bin 文件夾的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Is there a way to know if someone has bookmarked your website?(有沒有辦法知道是否有人為您的網(wǎng)站添加了書簽?)
Use of Different .Net Languages?(使用不同的 .Net 語言?)
Is there a C# library that will perform the Excel NORMINV function?(是否有執(zhí)行 Excel NORMINV 函數(shù)的 C# 庫?)
Determining an #39;active#39; user count of an ASP.NET site(確定 ASP.NET 站點(diǎn)的“活動(dòng)用戶數(shù))
Select x random elements from a weighted list in C# (without replacement)(從 C# 中的加權(quán)列表中選擇 x 個(gè)隨機(jī)元素(無需替換))
Best way to keep track of current online users(跟蹤當(dāng)前在線用戶的最佳方式)
主站蜘蛛池模板: 欧美精品一区二区三区在线 | 日韩欧美精品在线 | 色综合一区二区三区 | 成人av免费在线观看 | 久久久久亚洲 | 亚洲一区二区三区乱码aⅴ 四虎在线视频 | 欧美九九 | 91精品国产91久久久久久最新 | 中文字幕在线播放第一页 | 一区在线观看视频 | 国产精品视频久久久 | 国产一级在线观看 | 色秀网站| 亚洲三级在线观看 | 亚洲网址在线观看 | 国产成人精品一区二区三区四区 | 黑人巨大精品 | 欧美福利一区 | 欧美5区 | 99国产精品一区二区三区 | 精品久久久久久 | 久久国色 | 久草影视在线 | 欧美午夜一区 | 欧美亚洲视频 | 亚洲精品一区二区三区蜜桃久 | 免费视频一区 | 五月天婷婷狠狠 | 国产综合久久 | 欧美精品久久久久 | tube国产 | 欧美日韩国产在线观看 | 亚洲精品日韩在线 | 毛片av免费在线观看 | 亚洲乱码一区二区三区在线观看 | 国产精品一区一区 | 亚洲精品免费观看 | 日本不卡免费新一二三区 | 成人在线视频免费播放 | 国产一区在线看 | cao在线|