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

是“復(fù)制本地"項(xiàng)目引用的傳遞?

Is quot;Copy Localquot; transitive for project references?(是“復(fù)制本地項(xiàng)目引用的傳遞?)
本文介紹了是“復(fù)制本地"項(xiàng)目引用的傳遞?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

寫.建議的欺騙:因?yàn)檫@里的queston建議與鏈接問(wèn)題,我寧愿認(rèn)為它不是是騙子.

Wrt. the proposed dupe: Since this here queston suggests the opposite of the linked question, I'd rather like to think it is not a dupe.

首先,我確實(shí)閱讀了 復(fù)制本地"和項(xiàng)目引用的最佳做法是什么?(也 this) 無(wú)論如何我都必須嘗試一下,但是獲得對(duì)此的一般反饋似乎是必要的,因?yàn)?<關(guān)于這些東西的 rel="noreferrer">docs 太可怕了我只在 VS2010 上,也許他們?cè)谳^新的版本中改變了一些東西,很高興知道.

First, I did read What is the best practice for "Copy Local" and with project references? (also this) and I'll have to try this out anyway, but getting general feedback on this seems necessary as the docs on this stuff are horrible and I'm only on VS2010 and maybe they changed something in newer versions that'll be nice to know.

第二,我只對(duì)這個(gè)問(wèn)題的項(xiàng)目參考感興趣,因?yàn)槲乙呀?jīng) 閱讀來(lái)自 GAC 的程序集的處理方式不同,而 GAC 與我的問(wèn)題無(wú)關(guān).

Second, I'm only interested in project references for this question as I've read that assemblies from the GAC are handled differently and the GAC is irrelevant for my problem.

第三,在閱讀了建議的欺騙之后,但更重要的是這里的 answer@Albireo,區(qū)分 file 依賴項(xiàng)似乎也很重要,其中依賴項(xiàng)引用 dll 程序集文件和 project 依賴項(xiàng)(即我要問(wèn)的),其中依賴項(xiàng)引用了一個(gè)項(xiàng)目,并且隱式地引用了該項(xiàng)目的輸出文件.

Third, after reading the suggested dupe, but more so the nice answer here by @Albireo, it would also appear that it is important to differentiate file dependencies, where the dependency references a dll assembly file and project dependencies (i.e. what I'm asking about), where the dependency references a project and implicitly the output file of that project.

  • 2 個(gè) C# 可執(zhí)行項(xiàng)目
  • n C# dll 程序集項(xiàng)目
  • 這 2 個(gè)可執(zhí)行文件具有不同的輸出目錄,因?yàn)樗鼈儗为?dú)部署,因此它們?cè)陂_(kāi)發(fā)人員計(jì)算機(jī)上也是獨(dú)立的
  • 這 2 個(gè)可執(zhí)行文件依賴于某些 DLL 程序集(它們可能相互依賴)
  • 共有三個(gè)輸出目錄:
    • /x1 用于可執(zhí)行 1 項(xiàng)目
    • /x2 用于可執(zhí)行 2 項(xiàng)目
    • /lib 用于所有 dll 程序集
    • 2 C# executable projects
    • n C# dll assembly projects
    • The 2 executables have different output directories as they will be deployed separately and that way they're also separate on the developer machine
    • The 2 executables have dependencies on some of the DLL assemblies (which may depend on each other)
    • There are three output directories:
      • /x1 for executable 1 project
      • /x2 for executable 2 project
      • /lib for all the dll assemblies

      DLL 程序集allCopy Local設(shè)置為 false 以供其項(xiàng)目引用,因?yàn)樗鼈兌紭?gòu)建到相同的輸出目錄.

      The DLL assemblies all have Copy Localset to false for their project references, as they all build to the same output directory.

      這 2 個(gè)可執(zhí)行項(xiàng)目已將它們引用的所有 DLL 程序集項(xiàng)目引用的 Copy Local 設(shè)置為 true直接將DLL復(fù)制到/x1 /x2中.

      The 2 executable projects have set Copy Local to true for all the DLL assembly project references they reference directly, so that the DLLs will be copied into /x1 /x2 respectively.

      問(wèn)題現(xiàn)在是 wrt.到可執(zhí)行項(xiàng)目直接引用但通過(guò)引用的程序集傳遞的DLL:Will程序集,當(dāng)復(fù)制本地"在第一個(gè)程序集上設(shè)置為 true 時(shí),通過(guò)另一個(gè)程序集傳遞引用,復(fù)制到可執(zhí)行文件的輸出文件夾?

      The question now is wrt. to DLLs that are not directly referenced by an executable project, but only transitively through a referenced assembly: Will assemblies, that are only referenced transitively through another assembly, be copied into the output folder of the executable, when "Copy Local" is set to true on the first assembly?

      示例:

      • x1.csproj(例如輸出 = x1/one.exe)
        • 參考:dlA.csproj(例如 Output = lib/a.dll)與 Copy Local = *true*
        • (沒(méi)有直接引用 b.dll)
        • x1.csproj (e.g.Output = x1/one.exe)
          • Reference: dlA.csproj ( e.g. Output = lib/a.dll) with Copy Local = *true*
          • (no direct reference on b.dll)
          • 參考:dlB.csproj(例如 Output = lib/b.dll)與 Copy Local = **false**
          • (沒(méi)有直接引用 c.dll)
          • Reference: dlB.csproj ( e.g. Output = lib/b.dll) with Copy Local = **false**
          • (no direct reference on c.dll)
          • (沒(méi)有進(jìn)一步的相關(guān)參考資料)

          因此,我們有 one.exe -> 的邏輯依賴.a.dll ->b.dll ->c.dll,其中只有a.dll 明顯被復(fù)制到one.exe 的輸出目錄.其他兩個(gè) dll 是否也會(huì)被復(fù)制到輸出目錄中? 這是否記錄在某個(gè)地方?

          Thus, we have a logical dependency of one.exe -> a.dll -> b.dll -> c.dll, where only a.dll with obviously be copied to the output directory of one.exe. Will the other two dlls also be copied to the output directory? Is this documented somewhere?

          而且,是的,我試過(guò)了.而且,是的,它似乎可以工作,但我還沒(méi)有足夠努力地戳它,無(wú)論如何,我可能錯(cuò)過(guò)了更多的東西.(還有任何官方文檔的問(wèn)題.)

          And, yes, I tried it. And, yes, it seems to work, but I haven't poked it hard enough yet and anyway there maybe something more to it that I may have missed. (And also there's the question wrt. any official docs.)

          推薦答案

          似乎區(qū)分文件依賴項(xiàng)也很重要,其中依賴項(xiàng)引用 dll 程序集文件和項(xiàng)目依賴項(xiàng)(即我要問(wèn)的),其中依賴項(xiàng)引用項(xiàng)目并隱含地輸出該項(xiàng)目的文件項(xiàng)目.

          it would also appear that it is important to differentiate file dependencies, where the dependency references a dll assembly file and project dependencies (i.e. what I'm asking about), where the dependency references a project and implicitly the output file of that project.

          不是真的,不.

          MSBuild 并不真正關(guān)心引用是指向解決方案中的另一個(gè)項(xiàng)目還是指向 DLL.

          MSBuild doesn't really care if the reference points to another project in the solution or to a DLL.

          如果 ProjectA 依賴 ProjectB 來(lái)構(gòu)建 ProjectA ProjectB 必須已經(jīng)構(gòu)建(并且最多日期),然后 MSBuild 將提取其 DLL(而不是其 C# 代碼)并將其鏈接到 ProjectA.

          If ProjectA depends on ProjectB to build ProjectA ProjectB must be already built (and up-to-date), MSBuild will then pull its DLL (not its C# code) and link it to ProjectA.

          添加項(xiàng)目引用而不是 DLL 是語(yǔ)法糖".為了您的方便:這樣 MSBuild 知道它必須選擇引用項(xiàng)目的輸出,無(wú)論輸出是什么.

          Adding a project reference instead of a DLL is "syntactic sugar" for your convenience: this way MSBuild knows it must pick the output of the referenced project, whatever the output is.

          否則,您將不得不手動(dòng)預(yù)構(gòu)建依賴項(xiàng),找到它的 DLL 并將其鏈接到項(xiàng)目,每當(dāng)您切換構(gòu)建配置、移動(dòng)或重命名時(shí)都重復(fù)該過(guò)程.不太實(shí)用.

          Otherwise, you'll have to manually pre-build the dependency, find its DLL and link it to the project, repeating the process whenever you switch build configuration, move or rename things. Not really practical.

          另外兩個(gè)dll也會(huì)復(fù)制到輸出目錄嗎?

          Will the other two dlls also be copied to the output directory?

          如果直接從引用程序集的項(xiàng)目中使用依賴項(xiàng)中的任何類型的元素,則將復(fù)制該引用.

          If any kind of element from a dependency is used directly from the project where the assembly is referenced, that reference will be copied.

          一個(gè)例子可能是這個(gè)解決方案布局:

          An example could be this solution layout:

          • 我的解決方案
          • MySolution.ConsoleApplication
          • MySolution.FirstDependency
          • MySolution.SecondDependency
          • MySolution.ThirdDependency
          • MySolution.FourthDependency

          有了這個(gè)依賴鏈:

          • MySolution.ConsoleApplication
          • MySolution.FirstDependency
            • MySolution.SecondDependency
              • MySolution.ThirdDependency
              • MySolution.FourthDependency

              如果您構(gòu)建此解決方案,您會(huì)注意到在 MySolution.ConsoleApplication 輸出目錄中將有 MySolution.FirstDependencyMySolution.SecondDependency<的 DLL/code> 和 MySolution.ThirdDependency 但沒(méi)有 MySolution.FourthDependency 的 DLL.

              If you build this solution you'll notice that in MySolution.ConsoleApplication output directory there will be the DLLs for MySolution.FirstDependency, MySolution.SecondDependency and MySolution.ThirdDependency but no DLL for MySolution.FourthDependency.

              為什么會(huì)這樣?當(dāng) MSBuild 構(gòu)建 MySolution.SecondDependency 時(shí),它注意到向 MySolution.FourthDependency 聲明了一個(gè)依賴項(xiàng),但由于它無(wú)法從MySolution.FourthDependencyMySolution.SecondDependency 代碼中它決定執(zhí)行一些優(yōu)化";并從輸出中省略 MySolution.FourthDependency 程序集.

              Why is it so? When MSBuild builds MySolution.SecondDependency it notices that there's a dependency declared to MySolution.FourthDependency, but since it can't find any usage of any kind of element from MySolution.FourthDependency in MySolution.SecondDependency code it decides to perform some "optimization" and omits MySolution.FourthDependency assembly from the output.

              過(guò)去,當(dāng)我通過(guò) NuGet AutoMapper 添加到深度依賴"時(shí),同樣的問(wèn)題困擾著我:添加 AutoMapper 會(huì)添加兩個(gè)程序集引用,AutoMapperAutoMapper.Net4,當(dāng)?shù)诙€(gè)程序集需要對(duì) .NET Framework 4 引入的新集合對(duì)象執(zhí)行某種操作時(shí),第二個(gè)程序集由第一個(gè)程序集通過(guò)反射加載.由于第二個(gè)程序集是通過(guò)反射加載的,MSBuild 認(rèn)為它未使用并且沒(méi)有懶得到處抄.

              This same issue bit me in the past when I added through NuGet AutoMapper to a "deep dependency": adding AutoMapper adds two assembly references, AutoMapper and AutoMapper.Net4, where the second assembly is loaded by the first through reflection when it needs to perform certain kind of action on the new collection objects introduced by the .NET Framework 4. Since the second assembly is loaded through reflection MSBuild thinks it's unused and doesn't bother to copy it around.

              所以,是的,只要您直接使用它們,它們就會(huì)被復(fù)制,而不是通過(guò)反射.

              So, yes, they will be copied as long as you're using them directly and not through reflection.

              這是否記錄在某處?

              這種行為似乎是一種特征".在 MSBuild 中,當(dāng)我遇到此問(wèn)題時(shí),我設(shè)法找到了 Microsoft 一些人的博客文章,但目前我無(wú)法再次找到它.

              This behavior seems to be a "feature" of MSBuild, I managed to find a blog post by some folks from Microsoft back when I experienced this issue, but I can't find it again at the moment.

              這篇關(guān)于是“復(fù)制本地"項(xiàng)目引用的傳遞?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Is there a way to know if someone has bookmarked your website?(有沒(méi)有辦法知道是否有人為您的網(wǎng)站添加了書(shū)簽?)
Use of Different .Net Languages?(使用不同的 .Net 語(yǔ)言?)
Is there a C# library that will perform the Excel NORMINV function?(是否有執(zhí)行 Excel NORMINV 函數(shù)的 C# 庫(kù)?)
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ī)元素(無(wú)需替換))
Best way to keep track of current online users(跟蹤當(dāng)前在線用戶的最佳方式)
主站蜘蛛池模板: 亚色网站 | 看黄色大片 | 综合激情网 | 中文字幕日本 | 国产综合视频在线观看 | 国产精品国产 | 日韩视频在线观看 | 精品国产乱码久久久久久88av | 亚洲久久久久久 | 国产激情一区二区三区 | 中国av在线播放 | 欧美一区二区精品 | 欧美日韩精品一区 | 毛片在线免费 | 欧美专区在线 | 亚洲精品国产精品国自产在线 | 91免费版看片 | 九色在线视频 | 久久国产精品免费 | 在线免费观看黄色片 | 午夜精品国产精品大乳美女 | 日韩成人在线观看视频 | www.日本在线| 天天干少妇 | 激情六月天 | 天天爽夜夜爽夜夜爽精品视频 | 久久久久久久免费视频 | 亚洲黄色一级 | 国产理论在线观看 | 日本黄色中文字幕 | 九月色婷婷 | 在线观看av片 | a级片免费在线观看 | 久久久午夜精品 | 日韩城人免费 | 黄色片网站视频 | 日韩a视频 | 超碰av在线 | 久久精品欧美一区二区 | 99国产精品99久久久久久粉嫩 | 特黄毛片 |