How to execute a command in "Developer Command Prompt For VS 2013" via task?

Added by Guruprakash J about 1 year ago

Hi,

I am having few commands (of SonarQube), which will be executed only via "Developer Command Prompt".

So how do I achieve this using Cruise Control task?

Is there any alternate way to execute SonarQube commands in Cruise Control?

-->

1. MSBuild.SonarQube.Runner.exe begin
2. MSBuild abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...;
3. MSBuild.SonarQube.Runner.exe end

<--

Regards,
Guru


Replies (3)

RE: How to execute a command in "Developer Command Prompt For VS 2013" via task? - Added by Guruprakash J about 1 year ago

Hi,

Does the information provided is enough or require more details?

Can anyone suggest me how to achieve my query?

Regards,
Guru

RE: How to execute a command in "Developer Command Prompt For VS 2013" via task? - Added by Thomas Higgins about 1 year ago

Well, in my VS 2010, the command that creates the Visual Studio 2010 Developer command prompt is:

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

For VS 2013 it will be something similar.

You can try writing your own batch file, for example "sonarqube.bat," to do what you need. For VS 2010, sonarcube.bat would contain:

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
MSBuild.SonarQube.Runner.exe begin 
MSBuild abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...;
MSBuild.SonarQube.Runner.exe end

Just modify that first line for VS 2013.

From CC.NET you would then use an <exec> task to run sonarqube.bat to do your build.

I'm not familiar with SonarQube and I haven't tried the above, but that is how I would approach the problem.

Instead of a batch file, if you prefer you can use a NANT build script. Either one should work.

Good luck.

RE: How to execute a command in "Developer Command Prompt For VS 2013" via task? - Added by Guruprakash J about 1 year ago

Hi Thomas Higgins,

Thanks for your time on responding my query.

I got the solution.

I should use the full path to MSBuild instead of putting it in the PATH variable, which causes this issue for SonarQube Analysis.

-->

1. MSBuild.SonarQube.Runner.exe begin
2. "%programfiles(x86)%\msbuild\12.0\bin\MSBuild.exe" abc.csproj /t:Clean;Rebuild /p:VisualStudioVersion=12.0...;
3. MSBuild.SonarQube.Runner.exe end

<--

I tried your solution, but it does not work. I am not sure, whether I am doing anything wrong.

But I think, any command that requires Developer Command Prompt, should also work in the normal command prompt, provided the path to MSBUILD should be in full.

Thanks again for your response.

Regards,
Guru

(1-3/3)