TFS Build server Xamarin MsBuild Exception - xamarin

I have visual studio 2015 installed on the Build server with Xamarin installed. I followed the tutorial on the Xamarin web site here
I also logged into my xamarin account on the build server. I followed the xamarin creating a build definition on the web site here
But i keep getting the following exception when i kick off the build.
I'm not sure if its something wrong with the build defintion, the build machine, the android sdk, it all looks ok.
I did look into this stackoverflow answer but i've no idea where to start looking.
This is the build definition, it follows the Xamarin tutorial on the website, link above

If your local build is successful and just the TFS build is failing then it is usually due to dll reference path issue. Make sure that the Dll is referenced as a relative path in the project file (.csproj). Detail steps please refer this link Namespace could not be found - building using TFS
Also be sure that all referenced assemblies in the project can be found on the TFS build server. And double check the MSbuild version like comment suggested. You could try to add the /p:VisualStudioVersion=14.0 MSBuild argument in the build definition.

Related

DevOps Linking Project Dependency from another Solution

I'm receiving a build error in DevOps for a .Net Core 3 web application using a project dependent Razor Class Library from another solution.
For the DevOps pipeline, I receive the following build solution error:
##[error]d:\a\1\s\consumer.app.sln.metaproj(0,0): Error MSB3202: The project file "d:\a\1\s\..\framework.app\framework.rcl\framework.rcl.csproj" was not found.
I have another pipeline for the framework.app project (which also uses framework.rcl as a project dependency) but because the framework.rcl project is within that solution (and the same repo), it works flawlessly.
Is there any way (preferably without nuget) to access the framework.rcl razor class library from the consumer.app pipeline?
Everything works perfect locally as the project has been added in visual studio (via Add Existing project), but obviously that linked project is not included in source control for the consumer.app solution.
Please Help :)
I tripped over myself here. I was deep into managing project dependencies and using Azure Artifacts to do so.
However, the problem here wasn't a dependency issue. Msbuild in the Azure DevOps pipeline was simply trying to build a shared project used in the solution that wasn't available in the repo.
In Visual Studio, I simply unticked the build for the 'Release' configuration in Configuration Manager and DevOps no longer wants to build it.
I get a warning, but no error and my package reference to my Azure artifact (nuget) ensures everything wires up correctly.

Team Foundation Server build failure

I have following tools installed on my machine:
TFS 2017
Visual Studio 2017
MSBuild 14.0
In my application, I'm using some C#6 elements like string interpolation ($).
When I try to build it, controller says that it could not resolve the symbol.
Builds fail for both XAML and standard definitions.
In build logs, there's an information that it uses correct MSBuild 14.0 path: C:\Program Files (x86)\MSBuild\14.0\bin, but still failes to resolve C#6 elements.
I would really appreciate if you would help me with this problem, I've searched entire internet and found nothing :/
If you guys need any information, I'll be more than happy to provide it. Thank you.
TFS with XAML build is just using MSBuild to run the build. You could first try to use MSBuild command to run the build test locally, which will narrow down the issue.
If it works well on your dev machine and not works from a TFS server build. Very likely the environment problem.
To make sure the build successful, you should keep your build server environment the same with your local environment. Please double check this.
For trouble shooting, you could try to remote to your build agent, manually run your build and test on your build agent.
As for how to enable C#6, you could also refer this similar question, modify TFSBuildServiceHost.exe.config file which may do the trick. How do I enable C# 7 builds in Team Foundation Server 2015?
If you still get error, please include detail build failed logs here.

Boilerplate Visual Studio 2017 RC project fails to deploy to Azure App Service from GitHub

I'm attempting to deploy a boilerplate Visual Studio 2017 RC Asp.Net Core web app (no authentication) to an Azure App Service using the GitHub deployment option. The app has not been modified from the boilerplate code; literally: create a new app from the VS template, publish it to GitHub, and deploy to App Service.
Question
Are any particular settings necessary for VS 2017 RC apps to deploy to an App Service, or has the App Service SCM (Kudu) tooling simply not yet caught up with the VS 2017 RC project structure?
Details
I'm running into two problems that I think are probably related.
Problem 1: the MSbuild tools v15.0 don't appear to be installed on the app service. When building, Kudo defaults to v14.0:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Console Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin'.
I added a custom app setting, SCM_BUILD_ARGS=-tv:15.0, to try to force Kudo to use v15.0, but this had no effect. It continued to use v14.0 as before.
Problem 2: (and possibly as a result of using MSBuild 14.0): MSBuild issues the following error when attempting to restore NuGet packages:
Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
This error message is a little vague, but until recently the message would assert that no project containing a packages.config or project.json file was found in the solution. Both of these files are deprecated as of VS 2017 RC. I added an empty project.json file to see if that would fix the issue. The packages appear to be restored but it continues to fail due to missing project.json sections.
Resolution
#david-ebbo kindly provided guidance. In his test repo you'll find deploy.cmd and .deployment files. Copy both to the root of your repo. Then update Line 74 of deploy.cmd to point to your .csproj file. Deploying from GitHub should now succeed.
Similar to https://github.com/projectkudu/kudu/issues/2236.
The Kudu script generator doesn't yet know how to handle Preview3, but you should be able to use a custom deployment script. The key is to use 'dotnet restore' instead of 'nuget restore' and 'dotnet publish' instead of 'msbuild'. See sample here.
We will fix Kudu to handle this soon.

Publish website without roslyn

I am trying to create web application using Visual Studio 2015 and .NET 4.5.1.
When I publish the website, visual studio create folder named roslyn.
I know it's used to compile code on the fly, but unfortunately my hosting provider doesn't allow me to execute the compiler on their server.
How to publish the website without roslyn like previous version of Visual Studio?
EDIT:
I got this error when trying to acces my website.
It seems IIS trying to execute roslyn\csc.exe but my user account doesn't have permission to do that. With previous version of Visual Studio, this error doesn't show up.
I've just faced the same problem. When you create a new web project, two nuget packages automatically added to your project. If you remove them, your problem should be solved. Package names are: "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" and "Microsoft.Net.Compilers".
I had the same issue. Followed the steps from here. Basically:
Uninstall the package
Uninstall-package Microsoft.CodeDom.Providers.DotNetCompilerPlatform <Your Web API project name>
In your publish profile settings, uncheck "Allow precompiled site to be updatable". You can find this under Settings > Precompile during publishing > configure
After searching the same issued I face, I just came here. I read the above answer which is right.
I give the answer, because of Here is the good article to explain :
Why the publish code have this exe as well as development environment ?
What is the benefit and how to remove?
This is also the very good article, about the history of this exe
After countless effort....and according to this website.
I find that you can use /p:UseWPP_CopyWebApplication=true /p:PipelineDependsOnBuild=false in MSBuild to transform web.config, this also include the roslyn compiler in the build. The output is same as what you get by publishing in Visual Studio into file system
There is an open bug on the roslyn repository about this issue.
In my case all I had to do was to downgrade the dll Microsoft.CodeDom.Providers.DotNetCompilerPlatform from version 1.0.6 to 1.0.5.
I have had the same issue in Sept2016 when I took over an existing ASP.NET program. I found that there were multiple versions of the two compiler packages mentioned by Kemal installed in different projects of the solution.
So firstly I updated to get them the same. VS doesn't tell you that updates are available in this scenario (or maybe I missed them ?)
I then had to restart VS2015 for the packages to clean up properly.

How to update assembly assembly references in a web site?

I'm making a build using FinalBuilder Pro 7.
I've an ASP.NET web site and I'm trying to use FinalBuilder's "Precompile Asp.net 2.0 Application" action. Well, It fails.
To build it successfully I need to run Visual Studio, open the web site and either build it manually from within VS or manually update all references. After that it works.
Now the question: How to force FinalBuilder to update those references? Even if I create web deployment project associated with the web site and try to build it with msbuild action it would fail for the same reason. Somehow neither action updates references automatically.
Update: OK. Maybe I need to force msbuild to update references. How to do that?
I found some properties that I can change at msbuild action.
On called ResolveAssemblyReferencesDependsOn I tried to put the value = true. Didn't help.
Any ideas?
There are different types of projects in .NET like library project, website project, web API project etc. As you mentioned in your question it is a website project, so I am going to give you a solution for website project.
You can build a project by two ways. Either you can build by visual studio or you can build by using MS Build. If you build your project by using VS, you can update references of your dependencies by executing the command "Update-Package -reinstall" in package manager console. It will reinstall all the packages automatically.
Please note that, all your dependencies are listed in packages.config file.
Secondly if you have to build your project by MS Build using cmd prompt, to load all the dependencies from nuget, you have to execute nuget.exe. By which all your dependencies will be loaded, but their references may not be updated. So in website project you do not have .proj file. So you can't have access to the references of your dependencies. Now problem is that how you can modify your dependencies references?
In website project reference of an assembly exists in its .refresh file. So you have to modify that .refresh file to update the reference of an assembly in website project.
Have you tried using the 'Build VS.NET Solution' or 'MSBuild Project' actions? Both should resolve your assembly references, provided the reference is set to the right location. This requires that you at least have a project file.
As I understand it, the Precompile action (which uses the MS aspnet_compile.exe - see http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx) is designed to re-compile an asp.net application which has previously been built via VS or MSBuild. It does either an in-place compile to improve performance for the first user that hits the site, or creates a deployable application (removing source code etc). It's not meant as an alternative to VS/MSBuild.
I'm not 100% sure I understand the problem, but I believe you need to be able to correct some pathing on an assembly reference automatically.
I created a project to handle this (along with some other things): refswap.codeplex.com

Resources