Build/Test Issues

Unit testing Xamarin Portable Project

Started by Queck on 9,087 views

Hi,

I am starting a new cross platfom project using Xamarin.Forms.
I am putting my shared code into a "Portable" Class library.
I am using xUnit for unit testing.
My first unit test - <class> can be created - works nice using ReSharper or MS-Test.

As I try to run the tests with NCrunch I get the following Build-Error-Message:
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
..\packages\Xamarin.Forms.1.4.3.6358-pre2\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets (56, 3): Unerwarteter Fehler bei der XamlCTask-Aufgabe.
System.IO.FileNotFoundException: Die Datei oder Assembly "Xamarin.Forms.Xaml, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Dateiname: 'Xamarin.Forms.Xaml, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null'
bei Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
bei Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()


What is it I have to do, to get this test to run with NCrunch as well?

Thanks for any help!
Regards
Rainer
Hi Rainer,

This looks like an implicit reference to a build library inside the Xamarin package. See here for more information about this and how to fix it - http://www.ncrunch.net/documentation/considerations-and-constraints_implicit-file-dependencies.

Assuming you can solve the above problem, I'm afraid that I cannot guarantee that NCrunch will be able to work at all with this project. Xamarin is not supported by NCrunch at the moment.
Hi Remco,

thanks for the link. I at least was able to get my current tests running with NCrunch.
NCrunch is still complaining that it can't build one Project. I placed the error message below.

Regards
Rainer

NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
..\..\..\..\..\..\..\..\..\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets (1151, 2): Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'nCrunch.TestRuntime, Version=2.15.0.9, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea'. Perhaps it doesn't exist in the Mono for Android profile?
Dateiname: 'nCrunch.TestRuntime.dll'
bei Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
bei Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
bei Xamarin.Android.Tasks.ResolveAssemblies.Execute()


WARNING - Properties\AndroidManifest.xml (0, 0): @(Content) build action is not supported
WARNING - Properties\_SettingsStarted.txt (0, 0): @(Content) build action is not supported


Sorry, I'm afraid I can't provide a solution for this problem.

This appears to be caused by a clash between the Xamarin build and NCrunch's instrumentation. As far as I know, the only way to solve this would be to actually introduce proper support for Xamarin in NCrunch.

You're welcome to vote for this feature if you like - there is a request for it up on Uservoice: https://ncrunch.uservoice.com/forums/245203-feature-requests/suggestions/5998656-support-xamarin.
Hi Remco,

thanks for the feedback.
The feature request you pointed out now has 3 Votes from me ;-)

Regards
Rainer
This post has been deleted.

Post a reply

Log in to reply.