构建后将文件从一个项目复制到另一个项目 [英] Copy files from one project to another after build

查看:96
本文介绍了构建后将文件从一个项目复制到另一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于所有JavaScript的项目(我在三个项目中很常见).

I have a project for all my javascripts in side (that I made common for three projects).

在构建期间,我要将这些脚本移至三个项目中,如何通过编辑.csproj以及如何进行操作?

During a build I want to move these scripts to the three projects, how can I do this by editing .csproj and how?

更新:

我在相同的解决方案webapplication1webapplication2中,并且我正在为webapplication1编辑.csproj,我想复制测试文件夹中的所有文件

I have in the same solution webapplication1 and webapplication2 and i'm editing .csproj for webapplication1, and i want to copy all files in test folder

  <Target Name="AfterBuild">
    <Copy SourceFiles="$(WDTargetDir)test\" 
          DestinationFolder="$(SolutionRoot)WebApplication2">
    </Copy>
  </Target>

但是什么也没发生.

推荐答案

有两种方法可以做到这一点:

There is two ways to do that:

_编辑.csproject,在文件末尾,您将找到一个名为AfterBuild的目标(取消注释目标).

_ Edit the .csproject, at the end of the file you should find a Target named AfterBuild (uncomment the target).

<ItemGroup>
    <JavascriptFiles Include="*.js"/>
</ItemGroup>

<Target Name="AfterBuild">
    <Copy
        SourceFiles="@(JavascriptFiles)"
        DestinationFolder="PathWhereYouWantToCopyYourJavascriptFiles"
    />
</Target>

_在Visual Studio中发布构建事件(在项目属性中)

_ Post build events in visual studio (in project properties)

这篇关于构建后将文件从一个项目复制到另一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆