U Maniyar
U Maniyar

Reputation: 11

Set target in .csproj for gulp build

We moved to visual studio and we are facing some problem with TFS and my gulp build process.

In TFS, We have dev and beta environment before prod. Now my question is, after changing code in local how can I run gulp task (gulp dev) in .csproj as a so I can create main.css for dev and path change in my mainlayout.cshtml?

For ex: I have updated event.scss in local and it will modify my local main.css(which is not in TFS and Project - so we will not get permission issues). Upon check-in from TFS I have to create main.css for dev so that it will render in dev environment. I know it's done by build manager, but "How?" That I don't know.

Please help me with this, if you can. :)

Thanks in advance!!!!

Upvotes: 1

Views: 2071

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33728

You can run gulp by using Exec task, for example:

<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> 

Check this article.

Upvotes: 4

Related Questions