We have a team Foundation Server setup on premise. This is Azure-devops but a local setup.
We have the ASP.Net code. The code base doesn't have a .sln file or a .csproj file for the MSBuild. To build the code Dev team runs Below command from developers command prompt for VS2017
aspnet_compiler -p "E:\project\Release\netCompile" -v / E:\project\Release\netdeploy -f
I cannot run this command from the command line as it is throwing an error saying
aspnet_compiler is not recognized as an internal command.
I tried to use the following command in command line to open the developers command prompt, followed by the aspnet_compiler command.
script: '%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"" amd64_x86'
This seems to work fine but then again the aspnet_compiler command exit with code 1.
Can I know how can I achieve this task in Azure DevOps
- task: CmdLine#2
inputs:
script: 'echo call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
> deploy_app_test.bat
echo aspnet_compiler -p "./" -v / ../build -f >> deploy_app_test.bat
echo aspnet_merge ../build -a -o app -xmldocs >> deploy_app_test.bat'
- task: BatchScript#1
inputs:
filename: "deploy_app_test.bat"
arguments:
I was able to bypass this by creating a batch file with Dev Command Prompt and running it through command line.
You can run VsDevCmd.bat with "modifyEnvironment" set to true.
- task: BatchScript#1
inputs:
filename: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat'
arguments: '-arch=amd64'
modifyEnvironment: true
displayName: "Initialize Visual Studio Environment"
- script: # something that runs in the developer command prompt
Related
I build my project using the cygwin shell inside Windows 10 OS. My project does not build natively in the windows shell.
How can I configure the coverity to run in cygwin shell instead of the default windows shell ?
I needed to do C:\cygwin64\bin\bash --login -c "cd ~/path/to/desired; my_build_command" in the coverity build.
Installed:
Sonarqube 5.5
Sonar-runner 2.4 (http://dev.mamikon.net/installing-sonarqube-runner-on-ubuntu/)
When I try to run Jenkins with a simple project, this is the error I get:
[test] $ sonar-runner -e
-Dsonar.host.url=http://server_url:9000/sonar/ -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/test
SONAR ANALYSIS FAILED
FATAL: command execution failed. java.io.IOException: Cannot run
program "sonar-runner" (in directory
"/var/lib/jenkins/workspace/test"): error=2, No such file or directory
It seems that jenkins cannot find the sonar-runner program.
But when I open the server with a terminal, and run sonar-runner, it analyzes the project.
Can someone help me with this?
after hours of frustration, it turned out i had to add environment variable in the /etc/profile file.
export SONAR_RUNNER_HOME=/opt/sonar-runner
export PATH=$PATH:$SONAR_RUNNER_HOME/bin
i am trying to execute devenv.exe through windows batch command plugin in Jenkins
but it keeps on executing and fails to launch the application.
Console Output :
**In progressConsole Output
Started by user anonymous
Building on master in workspace C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson3900292017086958332.bat
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set DEVPATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>set PATH=D:\app\nazopay\product\11.2.0\dbhome_1\bin;D:\app\nazopay\product\11.2.0\client_1;C:\Program Files (x86)\Integrity\IntegrityClient10\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\cde\tools;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_23\bin\;C:\Program Files (x86)\Google\Chrome\Application;C:\MingW;C:\PROGRA~2\INTEGR~1\Toolkit\mksnt;%JAVA_HOME%;,;C:\Program Files\Java\jdk1.6.0_23;,;C:\Program Files\Java\jdk1.6.0_23\bin;%CLASS_PATH%;,;C:\Program Files\Java\jdk1.6.0_23\lib;,;C:\Program Files\Java\jdk1.6.0_23\lib;;C:\Program Files (x86)\M**icrosoft Visual Studio 10.0\Common7\IDE
C:\Program Files (x86)\Jenkins\jobs\TEMP\workspace>devenv.exe
You must execute devenv.com.
The devenv.exe always attempts to open GUI, even when commands are given, and it can't. The devenv.com has output directed to standard output and works fine from Jenkins.
You also must pass arguments.
Without arguments both devenv.com and devenv.exe just start the IDE GUI, which is not what you want. The correct command-line is
devenv.com projectname.sln /Build Release /Project projectname
First is path to the solution you want to build. Then the /Build flag is followed by configuration. If you have multiple platforms, you have to pass configuration and platform combination, e.g. Release|Win32. The /Project flag names project to build (including all dependencies). If omitted, it builds all projects selected for build in given configuration.
Why don't you use msbuild?
This would be a good starting point for your windows build script:
call "%VS100COMNTOOLS%\vsvars32.bat"
msbuild projectname.sln /target:Rebuild /l:FileLogger,Microsoft.Build.Engine;logfile=msbuild.log || goto error
goto end
:error
#echo ERROR: Build failed
exit/b 1
:end
exit/b 0
This way you can also capture the output log that you can parse with one of the jenkins plugins.
Ofcourse, adjust the VS100COMNTOOLS to your version of MSVS
Trying to get multiple test categories run via Jenkins mstest plugin command line gives a error
Command line Auguments :/testsettings:Test\Tests\Local.testsettings /category:"!FAIL&!LIVE"
gives
Console output :cmd.exe /C "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /resultsfile:Test\Tests\TestResults\Endpoints\Tests.trx /testsettings:Test\Tests\Local.testsettings /category:!FAIL&!LIVE /testcontainer:Test\Tests\Tests\bin\Endpoints\Tests.dll && exit %%ERRORLEVEL%%
Error:'!LIVE' is not recognized as an internal or external command,
Manual run via cmd : "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe" /resultsfile:Test\Tests\TestResults\Endpoints\Tests.trx /testsettings:Test\Tests\Local.testsettings /category:!FAIL&!LIVE /testcontainer:Test\Tests\Tests\bin\Endpoints\Tests.dll
This works when run via cmd but not with jenkins plugin
How do I get jenkins plugin not to strip out the quotes ? Or is there any other way.
I think it's a bug related with https://issues.jenkins-ci.org/browse/JENKINS-13412
I have worked almost one day with Jenkins to setup for automation publishing an ASP.NET web application. I have got it done in one local virtual machine, but it did not work when I tried with an production server.
Could any one can help or advise me? Here is the console error output:
......
no change for **SVNpath**1 since the previous build
Path To MSBuild.exe: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
Executing command: cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /t:rebuild D:\JenkinsInstall\jobs\ADDevelopmentPublishing\workspace\Web\ABC\ABC.csproj && exit %%ERRORLEVEL%%
[workspace] $ cmd.exe /C C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe /t:rebuild D:\JenkinsInstall\jobs\ADDevelopmentPublishing\workspace\Web\ABC\ABC.csproj && exit %%ERRORLEVEL%%
The command prompt has been disabled by your administrator.
Press any key to continue . . .
Build step 'Build a Visual Studio project or solution using MSBuild.' marked build as failure
Finished: FAILURE
------------------
Many Thanks
this line:
The command prompt has been disabled by your administrator indicates that you are not allowed to launch batch instructions on your server.