[英]Copy files in depended project reference
I have a solution with 2 projects, Project1 and Project2 project1 is referencing Project2 Project2 contains a folder called Content that contains xml files I want that when I build Project1, the content of Project2 will be copy to the Output directory of Project1, (Without the Content folder) I tried to achieved it using .targets file but it seems like the tasks in there are not executing.我有一个包含 2 个项目的解决方案,Project1 和 Project2 project1 引用 Project2 Project2 包含一个名为 Content 的文件夹,其中包含我想要的 xml 文件,当我构建 Project1 时,Project2 的内容将被复制到 Project1 的输出目录中,(没有内容文件夹)我尝试使用 .targets 文件来实现它,但似乎那里的任务没有执行。
I know I can add the files manually but I want anyone that referenced Project2 will receive the same behavior.我知道我可以手动添加文件,但我希望引用 Project2 的任何人都会收到相同的行为。
Will appreciate any help将不胜感激任何帮助
Try to add the two Project1's xml files as a link in the Project2.尝试将 Project1 的两个 xml 文件作为链接添加到 Project2 中。 When you build the solution, the files will be copied automatically.
构建解决方案时,将自动复制文件。
In Visual Studio:在 Visual Studio 中:
Read: https:\/\/andrewlock.net\/including-linked-files-from-outside-the-project-directory-in-asp-net-core\/<\/a>阅读:
https<\/a> :\/\/andrewlock.net\/including-linked-files-from-outside-the-project-directory-in-asp-net-core\/
Read:
https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-specify-build-events-csharp?view=vs-2022<\/a>阅读:
https<\/a> :\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-specify-build-events-csharp?view=vs-2022
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.