msbuild.exe does not run on Linux VM in Azure - linux

I am trying to use Jenkins to run my unittests. I have made a Jenkins Project for a build with a buildstep "Build a Visual Studio Project using MSBuild". My Jenkins server is installed on a linux vm which is in Azure.
You can see it here in the Jenkins UI:
When I run the build I get this Console Output:
Path To MSBuild.exe: msbuild.exe
FATAL: Unable to use this plugin on this kind of operation system
Executing the command msbuild.exe /ContinuousIntegration/ContinuousIntegration.sln from
/var/lib/jenkins/workspace/CSHARP_CI_TEST - UNITTEST
[CSHARP_CI_TEST - UNITTEST] $ msbuild.exe
/ContinuousIntegration/ContinuousIntegration.sln
Build step 'Build a Visual Studio project or solution using MSBuild' changed
build result to FAILURE
Build step 'Build a Visual Studio project or solution using MSBuild' marked
build as failure
Finished: FAILURE
I think the problem here is that I am trying to use msbuild.exe on a Linux VM. Is there a workaround for this or is it not possible to do this?
I have tried to use the msbuild.exe on the vm via a linux terminal, but it is not possible to run it.

To accomplish your requirement you have to install '.NET Core SDK' in the Azure Jenkins Linux VM and then you may simply use 'Execute shell' build step with the command 'dotnet build ContinuousIntegration/ContinuousIntegration.sln'
To install '.NET Core SDK' in your Azure Jenkins Linux VM, please go to https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install and click on 'Linux' in that page and then select the required Linux distribution and follow the steps provided.
For more information on MSBuild support on various operating systems, please refer https://github.com/Microsoft/msbuild/blob/master/documentation/wiki/Building-Testing-and-Debugging-on-.Net-Core-MSBuild.md
Just FYI, I have tested and reproduced your scenario and faced the same error which you have mentioned and then I have followed the above process and resolved the issue successfully. So I hope this helps. Cheers!!
PS: in your shell script you have to cd to the right folder for this to work.

Related

Appcenter iOS build fails when enabling sonarscanner

For an appcenter deployment I want to use SonarQube to analyze the code quality of the project. I have setup the appcenter-pre-build.sh and appcenter-post-build.sh scripts to install and enable Sonarscanner in the appcenter build process.
Now when I build for iOS, the build process fails, because it cannot find 2 files in the /Users/runner/work/1/.sonarqube folder on the build machine. Those files are /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml and /Users/runner/work/1/.sonarqube/conf/4/ProjectOutFolderPath.txt.
I know for a fact that the /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml is there, because in the logfile it says: "Writing Roslyn analyzer additional file to /Users/runner/work/1/.sonarqube/conf/cs/SonarLint.xml..." when running the appcenter-pre-build.sh script, which installs the sonarscanner.
I am installing the sonarscanner with the command: dotnet tool install --global dotnet-sonarscanner and the version that gets installed is 5.0.4.
On my SonarQube server I am running version 8.3 community edition and when the appcenter build runs, the analysis report appears in my project on my sonarqube server.
The build however fails.
Please advice on how to get the iOS builds in appcenter to succeed while sonarscanner is enabled.
Thank you in advance.
The problem is how appcenter logs the build process. From going through the logfiles, you get the impression that the build fails, because of the integration with Sonarqube.
The build failed however, because there were some context links missing in the c# code. Once this issue was found by building locally, The builds succeeded.

Is it possible to run vstest on a Linux machine via a release pipeline through Azure TFS

I am working on a release pipeline that should deploy our project artifacts and run tests over them.
The agent is on a Ubuntu machine.
So far I couldn't find a way to run tests over Ubuntu because as microsoft docs say we should install either the Visual Studio or Visual Studio Test Platform using an installer task on the agent.
The problem is neither of them are available on a linux OS , so I am a bit stuck here wondering if there is a third option that we can use to run our tests on this agent.
It depends on what type of your project is. If your project is .net core, you can try dotnet core cli task. Dotnet test can cross OS. If your project is .net fx, it cannot run on linux.
Run dotnet test command in .Net Core task
If you are using deployment group , you can run dotnet test command in a bash task and then use a Publish Test Result task to retrun trx files that Test has generated.

TeamCity Build Agent (v27767) deletes MsBuild.exe on run

TeamCity 8.0.6 CI box with build agent has been purring along for several years. After a system restart, TeamCity seems to have auto-upgraded the local build agent to version 27767. No other configuration changes were made, but this error now shows on build trigger:
Unable to find MSBuild at C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe, please check MSBuild environment variable to target to Microsoft .NET Framework 2.0/3.5/4.0 or Mono installation directory
I RDP'd into the box and see that MSBuild.exe went missing - strange. So I re-add it from a local install and retrigger a build. As soon as the build agent picks up the file, it disappears! Happens every time. Maybe Windows is protecting this folder?
The build agent then becomes "incompatible". I tried this workaround, but this doesn't stop msbuild.exe from being deleted.
I checked that there are no odd steps in my build configuration. What could be deleting or moving MSBuild?

publish and deploying .net core application to linux

Im having truble with publish and deploying a .net core web-api on a ubuntu 16.04 desktop ran in vmware. I have developed a simple web-api application with almost no extra implementation from the template v1.1. I have been installing and using some dependencies that are runnable in .net core.
Problem:
Im using framework dependent release v1.1.
I can launch a released version on windows by using "dotnet publish -c release" and it works fine. I then move the published files to my ubuntu machine and tries to run it I get the error that it cannot locate some kind of assembly that I know is in the dll folder.
However if I move the source code and project to my ubuntu machine and do a "dotnet restore" and "dotnet publish -c release" the application works. If I dont use the "dotnet restore" and tries to publish on my ubuntu machine it gets another "are you missing an assembly reference".
My guess is that when I do "dotnet publish -c release" it targets runtimes only for windows or ubuntu depending on the machine publishing.
Im grateful for help and explanation for this.
Sorry for bad language.
Stupid me have been running the wrong application dll. I always ran the application dll in the folder netcoreapp1.1 when I should have ran the same dll in the sub directory publish.

Cannot run VSTest.Console.exe from a Windows or non interactive service for a Windows Phone Project

I installed the Visual Studio 2012 Update 2 and successfully run a set of Windows Phone tests from the command line
I then tried to do this from Jenkins (using the VSTest Plug In) and received the following message which apparently has something to do with sandboxing..
Starting test execution, please wait...
Error: Could not start test run for unit tests for Windows Phone app: Unit tests for Windows Store apps cannot be run from a service or non interactive process. Please run unit tests from an interactive process..
Any ideas...
there's this commandline utility vstest.console.exe that's also able to run 3rdparty unit tests, if it has the right adapter(s). You have to use the /UseVsixExtensions option to vstest.console.exe. Additonally, to enable code coverage analysis I supply the /EnableCodeCoverage option.
"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"
/UseVsixExtensions:true /EnableCodeCoverage "C:\Users\Arve\Documents\Visual Studio
2012\Projects\MyApp\MyApp.Tests\bin\Debug\MyApp.Tests.dll"
The above command produces a a file with the suffix .coverage beneath the directory 'TestResults'.
I had same problem and it's resolved by removing the Jenkins from local services. This can be done by uninstall the Jenkins from Uninstall Program control panel. Or do the following:
Run command:
sc delete jenkins
Delete Jenkins from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
Reboot your machine
Start of running Jenkins from command: java -jar jenkins.war

Resources