VSTS Build Definition for Android failing - build

I'm starting using the build definitions from Team Services for a Xamarin Android App. In Visual Studio everything works fine and I can check in the code to VS Team Services.
UPDATE 1
Now, at the moment to create an Build Definitions for my project, it's falling.
And this is part of the log:
2016-10-13T03:30:45.7198826Z Considered treating "Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL" as a file name, but it didn't exist.
2016-10-13T03:30:45.7748834Z 2>C:\a\1\s\DentalLife\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets(40,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.FixedCreateCSharpManifestResourceName" task could not be loaded from the assembly C:\a\1\s\DentalLife\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'file:///C:\a\1\s\DentalLife\packages\Xamarin.Forms.2.3.1.114\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\a\1\s\DentalLife\DentalLife\DentalLife\DentalLife.csproj]
2016-10-13T03:30:45.7778918Z 2>Done Building Project "C:\a\1\s\DentalLife\DentalLife\DentalLife\DentalLife.csproj" (default targets) -- FAILED.
2016-10-13T03:30:45.7808866Z 1>Done Building Project "C:\a\1\s\DentalLife\DentalLife\DentalLife.Droid\DentalLife.Droid.csproj" (clean;PackageForAndroid target(s)) -- FAILED.
2016-10-13T03:30:45.8018852Z
2016-10-13T03:30:45.8018852Z Build FAILED.
After, a couple of days trying to find any information I found the following stackoverflow links:
Visual Studio Team Services - Build fails, definition wrong?
TFS remains out of sync after Get Sources step
Basically, in those post they mention that this could be a security related issue.
I tried following all suggestion from changing the permissions to changing some parameters like the Build job authorization scope. But any luck so far :-(
UPDATE 2
After a lot of attempts and looking on Internet, I found that te problem was the hosted agent had a different version for Xamarin.Froms. Then I found this post http://www.blogaboutxamarin.com/xamarin-devops-with-vsts-setup-a-cross-platform-build-agent-on-windows/ where I created a on-premise agent and the Xamarin.Forms version got updated to be 6.1.1. After that I was able to queue a build ALL in Green :-)
However, I decided to upgrade the Xamarin.Forms version to be 2.3.1.114 in my Solution, because I needed to use a class that is available in that version. Locally, it builds and run OK.
Now, the problem is again the agent build in VSTS. This time is showing me a different error. That there are some dlls that couldn't be found:
obj\Release\android\src\mono\android\support\v7\internal\widget\ActivityChooserModel_OnChooseActivityListenerImplementor.java:8: error: package android.support.v7.internal.widget.ActivityChooserModel does not exist
obj\Release\android\src\mono\android\support\v7\internal\widget\ActivityChooserModel_OnChooseActivityListenerImplementor.java:33: error: package android.support.v7.internal.widget does not exist
2016-10-17T02:26:08.1053649Z private native boolean n_onChooseActivity (android.support.v7.internal.widget.ActivityChooserModel p0, android.content.Intent p1);
In my Android project I have:
Finally, this is the link of the GitHub repo where you can find the code:
https://github.com/Lesthad/CIXamarinShowTest
Any help would be very appreciate. Thanks and sorry for this long post :-(

The solution is that you need to specify JDK version in Xamarin.Android step of your build definition.

Related

SpecFlow/MSBuild Codebehind Gen - Generate All task

On a project I am working on, I am maintaining some Feature Tests written in SpecFlow. Our team started using Visual Studio 2017 about a year ago, and we finally got around to doing some upkeep on our tests!
Our tests for the project I'm working on were originally written in SpecFlow 2.3.2, and were last updated in Visual Studio 2015.
The SpecFlowSingleFileGenerator is known to not work on VS 2017, so I spent the better part of yesterday changing our suite to use the MSBuildSingleFileGenerator instead as detailed in this article in SpecFlow's official documentation
Problem:
Locally, I can build my solution, including the Feature Test project just fine.
However, I keep getting the following error when I try to build the project on our build server:
[exec] C:\CheckoutDirectory\My Awesome Project\packages\SpecFlow.Tools.MsBuild.Generation.2.3.2\build\SpecFlow.Tools.MsBuild.Generation.targets(45,5):
error MSB4036: The "GenerateAll" task was not found.
Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin" directory. [C:\CheckoutDirectory\My Awesome Project\AwesomeProject.FeatureTest\AwesomeProject.FeatureTest.csproj]
I should point out that our team has no experience with writing MS Build tasks, as hitherto we haven't needed to; we use NAnt build scripts on TeamCity to manage our build work. It's clear that error message would be helpful...if we knew literally anything about it.
Now, normally the correct answer would be: Google it. I did that, and this specific error has no pertinent results.
Additionally, this is blocking my team, since we need our build to work. I don't have the time to do the research and education necessary to properly understand how MS Build technology works. That wil have to come later.
Question:
Bearing in mind that SpecFlow has broken our process, and our team's lack of knowledge about the MS Build system: I need to know how to get around the "GenerateAll" task was not found error. What do I do to get around it?
Secondary Question:
I'm also open to lateral thinking. Is there some way to hack either VS 2017 or SpecFlow to make the SpecFlowSingleFileGenerator "compatible" with each other? The objective here is NOT to avoid making changes, but to control the changes. I need a path towards transitioning from the old file generator to the MS build generation system.
Additional Information:
So, I did some digging, and I found a place where "GenerateAll" is being called in the SpecFlow.Tools.MsBuild.Generation.targets file:
<Target Name="UpdateFeatureFilesInProject"
DependsOnTargets="BeforeUpdateFeatureFilesInProject"
Inputs="#(SpecFlowFeatureFiles)" Outputs="#(SpecFlowFeatureFiles->'%(RelativeDir)\%(Filename).feature.cs')">
<GenerateAll
ShowTrace="$(ShowTrace)"
BuildServerMode="$(BuildServerMode)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
ProjectPath="$(MSBuildProjectFullPath)"
ForceGeneration="$(ForceGeneration)"
VerboseOutput="$(VerboseOutput)"
DebugTask="$(SpecFlow_DebugMSBuildTask)"
>
<Output TaskParameter="GeneratedFiles" ItemName="SpecFlowGeneratedFiles" />
</GenerateAll>
</Target>
Because I've confirmed that this is being copied out to the build server, the situation is yet more mysterious. It appears that the NuGet package is being pulled down faithfully. Therefore, I can't figure out why my local copy is behaving differently than the copy on the build server.
I am not sure where you found this statement:
The SpecFlowSingleFileGenerator is known to not work on VS 2017
The SpecFlowSingleFileGenerator is working in VS2015, VS2017 and VS2019. We see it as a legacy feature, but it's still there. Since some weeks it is disabled by default, but you can enable it in the options.
It works for SpecFlow >= 2.3.2 and 2.4. For SpecFlow 3 you have to use the MSBuild integration. There are some problems with older versions of SpecFlow, but with them it can also work. It depends on your setup.
About your MSBuild error:
The MSBuild Task for SpecFlow < 3.0 is in the specflow.exe. Is it on your build server?
It is part of the SpecFlow NuGet packages. Normally you get this kind of error if MSBuild can't find the assembly where the task is.
For "debugging" problems with MSBuild, I can highly recommend to use the MSBuild Structured Log Viewer (http://msbuildlog.com/). With it, it makes it easy so see what is happening in your build.
We have an example for MSBuild Code- Behind- Generation with SpecFlow 2.3.2 here: https://github.com/techtalk/SpecFlow-Examples/tree/master/MSBuild/OldCSProj_SpecFlow232
You could compare your project with this example.
Full disclosure: I am one of the maintainers of SpecFlow.

VS compiling successfully when obvious errors exist after upgrading to framework 4.6.1

After upgrading my .net web project to use Framework 4.6.1 so that I can take advantage of c#6, I have experienced a problem building projects..
I say I have a 'problem' building, it's more like I don't have a problem building. It IS building successfully when in fact it should be failing! Take a look at the screenshot provided; web.config on the left, obvious syntax errors on the right, and a successful build below.
It builds successfully when I do a build / rebuild or run it in debugging; but does actually fail if I try to perform a publish.
Just to further, I have verified that the file that I am editing resides in the correct directory within App_Code, that I am building the correct project and have reset VS multiple times. I've tried to go through all school boy errors; but I think that as it successfully runs but throws a compilation error at that stage it is something down to the Roslyn compiler?
Also note, this is a freshly created project; All I have done is written some basic classes, upgraded the framework, and added a blank aspx page.
Recreating the solution file fixed this error.
Another cause could be down to the fact that I created the project as a WebApplication instead of a Website, but am unsure why this would cause successful builds with syntax errors.
Regenerating the solution with the project setup as a Website instead of a WebAppplication fixed the issue (although I had to change front-end control attributes 'CodeBehind' to 'CodeFile'; a difference between the two types of project).

Simulation examples on SOFA framework with haptics force feedback

For last two weeks I was trying to build SOFA framework and run some examples, with haptics force feedback, from this directory ../plugins/Sensable/examples/Denistry/.
But unfortunately I can not succeed to run it properly, because runSofa.exe stops running, when I open any of those .scn files from the directory mentioned above. I followed all the instructions to build and run from official site (https://www.sofa-framework.org/community/doc)
What I did is :
downloaded 16.08 branch sources from https://github.com/sofa-framework/sofa
configured and generated Visual Studio win32 project by CMake
built release sofaRun and sensable plugin
errors occurred in senable project, especially NewOmniDriver.cpp and OmniDrivver.cpp files. I added sofa::helper namespace [adding_sofa_helper][1]
then it compiled without errors
I am hoping to find anyone who was able to run or build simulations with haptics force feedback and want to understand what I am doing wrong. If you need more explanation about what exactly I did, I will provide it. I will appreciate any response related to this topic.
I have succeed on running examples with haptic feedback using sensable plugin. The sofa developers are still updating the sources of the framework. So I checked the master branch of their repository and build that sources. After that the examples with haptic feedback worked as it suppose to do. – Ruslan Rakhmatov just now

Building Django on Visual Studio Online

I'm working on a Django (1.8.6) project and using Visual Studio Online's GIT source control. I am building the application successfully in my local environment and push the changes to the VSO. However, whenever I try to build the application on VSO to be able to benefit from "Continuous Integration" as a next step (will try to deploy Azure), it fails by giving the error below:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Python
Tools\Microsoft.PythonTools.Web.targets (235, 5) The environment 'env
(Python 3.4) (unavailable)' is not available. Check your project
configuration and try again.
Unexpected exit code received from msbuild.exe: 1
My build definition on VSO:
Build Definition Screenshot
Python Version: 3.4.3
VS Version: 2015
Any suggestions regarding to my case is highly appreciated.
This is a known issue for PTVS. MS is still working on it. Refer to this thread for details: https://github.com/Microsoft/PTVS/issues/128
There is a workaround in that thread you may use, I quote it here. The second link is unavailabe now, but the first one still works.
For deployment via PowerShell, I found this, which looks correct
AFAIK.
http://www.kenneth-truyers.net/2014/02/06/deploying-cloud-services-to-azure-with-powershell/
You can also use the Python Azure SDK to deploy, but that's not as
well documented. This is what this test does:
https://github.com/Azure/azure-sdk-for-python/blob/master/tests/test_servicemanagementservice.py#L940
Both of these assume that you are able to create the .cspkg, as that's
the file you have to upload to blob storage.

Use Jenkins CI for Qt projects

I'm trying to use Jenkins for some project I have written in Qt framework.
There is qmake plug-in for Jenkins in Jenkins wiki page, although this plug-in doesn't exist in Jenkins plug-in list.
I've looked for .hpi file for qmakebuilder plug-in, couldn't find it though. So I download the source code from the given repository, tried to compile it as described in Jenkins wiki... but I get list of error indicating java.util.NoSuchElementException.
Any of you guys have used this plug-in? or any other Jenkins plug-in to compile Qt projects with?
First of all, my JAVA_HOME variable was not pointing at the right folder i.e. JDK folder and it was set to JRE which caused the maven to not work properly.
But after fixing that, I was still getting some compilation error.
Finally, I asked Jenkins people and realized for some reason qmakebuilder is not compatible with JDK 7. Therefore, I download the JDK 6 compile the code with that version and it got compiled just fine. I got the hpi file in the target folder.
Plus, the hpi file for this plug-in NOW can be find here.