MSBuild Your project.json doesn't have a runtimes section - jenkins

I have an issue with MSBuild which give this message:
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win10-x86-aot": { } }' to your project.json and then re-run NuGet restore.
I found several issues as the mine on StackOverflow and the solution seems to be to delete the obj folder but it was not the same context.
I installed only MSBuild for Visual Studio 2017 (so, without Visual Studio) for using it with Jenkins. My Jenkins master is installed on a Mac OS, and MSBuild is installed on a Windows 10 PC which is used only to do this job.
If I use my development machine (Windows 10 laptop with Visual Studio 2017) as Jenkins remote agent and I launch the build from Jenkins portal, it works well, but if I use the other PC with MSBuild, I have this issue.

Okay, so I solved my issue adding a section in my CSPROJ, according to the MSDN documentation here

Related

Using VS2019 with TFS2018 vnext build system without server side work around

I recently ran into a problem trying to use VS2019 with the TFS2018 vnext build system.
You cannot select VS2019 in the "Visual Studio Build" step, and selecting "Latest" does not use Visual Studio 2019.
On a test server, upgrading the server software from TFS 2018.3 to Azure Devops Server 2019 fixes the issue. Is there a simple work-around that would allow Visual Studio 2019 to be used without affecting the TFS server in a questionable way.
This question extends the question here:
Using VS2019 with TFS2018 vnext build system
Instead of using the Visual Studio Build step, I tried switching to the MSBuild Build step and specified the path to msbuild.exe as follows:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin
The build ran successfully and used Visual Studio 2019.

TFS build dosn't complete correctly when I use c# 7 feature in my code

I've installed TFS (version 15.112.26307.0) on windows server 2012 R2. all team members use VS2017 to coding. I've created an agent (I've tried versions vsts-agent-win7-x64-2.112.0, 2.117.0 ,2.140.0)and set it's MSBuild version to MSBuild15.0 :
MSBuild15.0 has already installed on the server :
But when we use c# 7 features in our code(like "int out x") building code via TFS raise error as below (it use MSBuild14.0 to build our code, why?)
My agent capabalities is not correct :
Use the Visual Studio Build task. It allows you to specify the Visual Studio version used to run builds.
Seems the capabilities cannot be detected by the agent. If you have installed the VS 2017 on the build agent server, then you can try to restart the agent service to check if that works.
If that still not work, you could try below things:
Add the capabilities manually.
The path of them are(Enterprise version for example):
VisualStudio_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
VisualStudio_IDE_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\
MSBuild_15.0 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\
MSBuild_15.0_x64 C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\
VSTest C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common\IDE\CommonExtensions\Microsoft\TestWindow
Specify the path to Msbuild 15.0:

No agent could be found with the following capabilities Xamarin.Android

I'm trying to create a build definition to build and package an Android app based on Xamarin Forms.
I want to do so thanks to TFS 2017 Update 1 on premise.
I've installed Visual Studio 2017 and Xamarin on my build server, and even after restarting my server, my agent does not find the Xamarin.Android capability.
I'm still getting en error while queuing one build :
No agent could be found with the following capabilities AndroidSDK, MSBuild, Xamarin.Android, JDK
The only capability that is missing on my agent is the Xamarin.Android.
Do you have any idea on how to add it on my agent ?
Regards
Add an environment variable named Xamarin.Android and the value of this would be
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin
or change it wrt your Visual Studio version and installation path.
Install Visual Studio 2017 on the build server and check Xamarin in the setup
Please check on the build server for an environment variable named Xamarain.Android and if it not exist add it or add an capability in TFS on the agent

TFS 2010 issues building C#6.0 code with MS Build 14

We have TFS 2010 running happily on a dedicated build server.
I have installed Microsoft Build Tools 2015, which includes MS Build 14 successfully on the build machine, but not Visual Studio 2015.
I've created a custom template which alters the "ToolsPath" property of the "Run MSBuild" activity to "C:\Program Files (x86)\MSBuild\14.0\Bin".
The build runs, but fails on this particular error:
(CoreCompile target) ->
CSC : error CS1566: Error reading resource 'ProjectName.exe.licenses' --
'Could not find file 'C:\develop\Sources\ProjectName\obj\x86\Release\ProjectName.exe.licenses'.' [C:\develop\Sources\ProjectName\ProjectName.csproj]
The same project builds fine using Visual Studio 2015 running from another machine.
It makes no difference whether the TFS build definition includes these MS Build arguments or not:
/tv:14.0 /p:VisualStudioVersion=14.0
Does anybody have a success story of using a TFS 2010 build agent to successfully build a C#6.0 project?
I solved this in the end by installing Visual Studio 2015!
The /tv:14.0 /p:VisualStudioVersion=14.0 argument may don't work for MSBuild Tools.
You should customize the tfs build process template to set ToolPath of the Run MSBuild for Project to target to MSBuild14; and set ToolVersion to "14.0".
Check this link for the detailed information:BuildActivity ignores ToolsVersion

Web.config fail to transform on TFS 2012

I currently work on a MVC 4.0 project that was upgraded to MVC 5.0 using the official guide.
I use Visual Studio 2012 locally and a publish profile was created for the project.
Locally I call msbuild via the Visual Studio developer command prompt using: msbuild /m /p:Configuration=Dev;DeployOnBuild=true;PublishProfile=Dev my-solution.sln
All projects in the solutions do have a Dev configuration and there is a web.dev.config.
The command line on the server is the same.
So far the difference is that on the server only the visual studio shell is installed (not the full) and we cannot install the full instance of VS2012 on the server.
Also, seeing on the install of TFS on the server, I discovered that only v9.0 target files were installed (Visual Studio 2008). Copying Visual Studio 2012 target files do not fix this problem.
I see 2 solutions so far but searching for a third.
Install full Visual Studio 2012 instance
Update csproj to include a target transformConfigFiles (basically copy and paste the content of the "Microsoft.Web.Publishing.targets" section) or import the file via a declaration inside of the .csproj
Would there be a third solution available?
It is pretty common to install full Visual Studio on your build server. As of VS 2012 you couldn't even run Unit Tests in your build without VS installed.
I'd suggest installing VS and seeing if that fixes the issue.

Resources