【问题标题】:Set target in .csproj for gulp build在 .csproj 中为 gulp 构建设置目标
【发布时间】:2017-03-17 06:35:50
【问题描述】:

我们搬到了 Visual Studio,但在 TFS 和我的 gulp 构建过程中遇到了一些问题。

在 TFS 中,我们在 prod 之前有 dev 和 beta 环境。 现在我的问题是,在本地更改代码后,如何在 .csproj 中运行 gulp 任务 (gulp dev),以便我可以在 mainlayout.cshtml 中为 dev 和路径更改创建 main.css?

例如:我在本地更新了 event.scss,它会修改我的本地 main.css(它不在 TFS 和项目中 - 所以我们不会遇到权限问题)。从 TFS 签入后,我必须为 dev 创建 main.css,以便它将在开发环境中呈现。 我知道这是由构建经理完成的,但是“如何?”这个我不知道。

如果可以的话,请帮助我。 :)

提前致谢!!!!

【问题讨论】:

    标签: visual-studio build msbuild gulp


    【解决方案1】:

    你可以使用 Exec 任务来运行 gulp,例如:

    <Target Name="BeforeBuild"> 
         <!-- Is node installed? --> 
        <Exec  
           Command="node || start http://nodejs.org &amp;&amp; echo You need to install NodeJS" ContinueOnError="false" /> 
         <!-- it is, so have npm install all dependencies --> 
         <Exec  
           WorkingDirectory="$(ProjectDir)"  
           Command="npm install"  
           ContinueOnError="false" /> 
         <!-- npm installed bower for us, so now let bower install it's dependencies --> 
         <Exec  
          WorkingDirectory="$(ProjectDir)"  
           Command="node_modules\.bin\bower install"  
           ContinueOnError="false" /> 
         <!-- run the gulp task for the appropriate configuration --> 
         <Exec  
           WorkingDirectory="$(ProjectDir)"  
           Command="node_modules\.bin\gulp $(Configuration)"  
           ContinueOnError="false" /> 
       </Target> 
    

    查看this 文章。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-24
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      相关资源
      最近更新 更多