簡體   English   中英

MsBuild目標,將項目依賴項復制到目標目錄

[英]MsBuild target that copies project dependencies into target dir

MsBuild目標中的哪個目標將項目依賴項(引用的項目依賴項)復制到目標目錄(例如\\ bin \\ Debug)。 當然,它可能是編譯目標,但我想知道最接近的目標。

MsBuild目標列表: https ://gist.github.com/StevenLiekens/cae70cce25344ba47b86

但我想知道最接近的目標。

那應該是目標_CopyFilesMarkedCopyLocal

https://gist.github.com/StevenLiekens/cae70cce25344ba47b86#file-target-xml-L93

您可以創建兩個測試空白項目,項目A引用項目B,然后將MSBuild項目的生成輸出詳細程度更改為“ 詳細”或“ 診斷” (“ Tools ->“ Options ->“ Projects and Solutions - >Build and Run ->“ MSBuild project build output verbosity >Build and Run MSBuild project build output verbosity ,生成項目A,在輸出窗口的生成日志中,您將找到有關項目A的以下消息:

2>Target "_CopyFilesMarkedCopyLocal" in file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets" from project "c:\users\xxx\source\repos\ClassLibrary2\ProjectA\ProjectA.csproj" (target "CopyFilesToOutputDirectory" depends on it):
2>Task "Copy"
2>  Copying file from "c:\users\xxx\source\repos\xxxx\ProjectB\bin\Debug\ProjectB.dll" to "bin\Debug\ProjectB.dll".
2>  Copying file from "c:\users\xxx\source\repos\xxxx\ProjectB\bin\Debug\ProjectB.pdb" to "bin\Debug\ProjectB.pdb".
2>Done executing task "Copy".
2>Using "Touch" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
2>Task "Touch"
2>  Creating "c:\users\xxx\source\repos\ClassLibrary2\ProjectA\obj\Debug\ProjectA.csproj.CopyComplete" because "AlwaysCreate" was specified.
2>Done executing task "Touch".
2>Done building target "_CopyFilesMarkedCopyLocal" in project "ProjectA.csproj".

就像我們知道的那樣,如果我們引用一個項目, Copy Local引用項目的“ Copy Local ”屬性將設置為True,在我們構建該項目時,該引用將被復制到目標目錄。

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM