Gulp:Error while running from Visual Studio Post Build Event - visual-studio-2010

I am trying to run gulp default task on VS 2010 Post Build Event
like
cd $(ProjectDir)
gulp
But VS Freezes when i click on Build Solution while same is working fine on command window.
Anyone faced this issue earlier or help me in this?

Edit: Visual Studio 2015 now has full support for gulp, with hooks to make it much easier to integrate.
Old answer: This is because gulp-watch is a long-running process; it's watching files for changes, and so does not exit.
Perhaps on your post-build task, you could use something like cmdow to fire off the task in a separate process, which should let the build "finish" properly.

Try using powershell start-process gulp as your command line. You may add a specific task too: powershell start-process gulp mytask

Related

In Visual Studio 2019, What Command is Run When 'Test All' is Clicked?

Visual Studio 2019 (and most Visual Studios that I've worked with that have a Test Explorer) have a 'Test All' button.
I'm curious as to what the CLI-equivalent command is run when this is clicked (including all options fed to this command). For example, dotnet test .... I'm sure the --no-build option is not specified, as clicking this button runs a build. Does anyone know what the entire command that is run is?
If you are looking to replicate the function of the Test Explorer at the command line then for Visual Studio on Windows, "VSTest.Console.exe is the command-line tool to run tests." Within Testing tools in Visual Studio, see Run tests from the command line.
The IDE, however, is not spawning new vstest.console processes on every test run. It is 're-using' existing test runner instances via an API/protocol.

command line solution build using devenv rebuilding more projects than visual studio solution build

I am trying to mimic visual studio solution build from command prompt using batch script but there is significant difference between manual solution build(ctrl+shift+b) inside visual studio and command line solution build using devenv in terms of project rebuild counts. More projects are getting rebuilt from command line in comparison to visual studio solution build.
I am using this for command line build in batch file:
call"C:\ProgramFiles(x86)\MicrosoftVisualStudio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
devenv solution_name.sln /build "Debug"
command line solution build output looks like this: devenv solution build using cmd prompt
visual studio solution build output looks like this: manual vs solution build output
I have tried changing the configurations too but it didn't help, I am curious why this might be happening and is there a way to get same result from command line build as of manual vs solution build?

How to execute VS2013 MSBuild from an EXISTING command prompt

I would like to "MSBuild" (VS2013) my application as part of a bigger ".cmd" script. I cannot let visual studio build a shell and issue commands into that shell (please don't ask why; if that were negotiable I wouldn't have to ask this question in the first place)
I have the shell, its path, and its environment variables prepared for everything else (except Visual Studio 2013 and MSBuild). What can I do or invoke, so that the next command then can be "MSBuild..."
I have spent hours searching in vain but all I have found looks to me like it requires building a new shell, applying a mouse click, or loosing the standard input.
Thanks
Run vsvars32.bat. It is in the Common7\Tools folder of your Visual Studio installation. In the case of VS 2013, this folder is available in the environment variable, VS120COMNTOOLS. It is similar for other versions of VS. Your script will be something like:
call "%VS120COMNTOOLS%vsvars32.bat"
msbuild mysolution.sln /t:Build

Running Grunt from Visual Studio post build event command line

I've attempted to do this both in Visual Studio 2010 and Visual Studio 2012. If my Gruntfile.js file is in the root of my project I can run the "grunt" command from the post build event command line and it runs without a problem.
grunt or grunt.cmd
But if it's in a sub directory
$(ProjectDir)Public\grunt or $(ProjectDir)Public\grunt.cmd
It gives me this error
The command "c:\web\Public\grunt.cmd" exited with code 9009.
I've been researching this but I'm not finding any much help out there. I did find in the grunt documentation that I need to use "grunt.cmd" instead of just calling "grunt" but thats not helping me much.
What's happening is you're specifying an exact path for grunt, which doesn't actually reside at $(ProjectDir)Public\. When you're in that directory on a command prompt and type grunt, it executes because you've set your path environment variable to include the directory where grunt lives.
Luckily the post build commands in VS act like a command window, so you can put this in your post build commands:
CD $(ProjectDir)Public\
grunt
And that should work (assuming a default grunt task is defined).
If you had Visual Studio open and then:
Installed node package manager (npm) and grunt
Then tried to run pre/post build commands including grunt command.
The build will simply fail with the "exited with code 9009" message. (Meaning "I don't know what grunt command is")
To resolve this situation just close visual studio and reopen it (as #longda mentioned on his comment) and everything will work just fine.
I'm using VS 2013 Premium and latest version of npm/grunt.
You can run as post build using task runner as shown below.
Right click on the build --> bindings--> and then specify if you need it to run post or pre build
Somewhat related, I had a weird issue that xcopy would not run after grunt, running them as a single command fixed it:
cd $(SolutionDir)..\App
grunt release && xcopy "$(SolutionDir)..\App\release" "$(TargetDir)Content\" /Y /E /S

Visual Studio crashes during runtime

Please can you help me with this VS 2010 issue. This issue comes out every time I want to run my project. Can it be fixed somehow? The screen shot isi aviable in attached file.
try registring IIS again...To do this follow the given steps...
go to C:\Windows\Microsoft.NET\Framework\v4.X folder from Command prompt
execute aspnet_regiis.exe -I command from Command prompt
close the Visual studio and re-open.
Try re-run the project again.
Thanks

Resources