unable to find nunit assembly for xamarin test cloud in VSTS - xamarin

Hi I am using VSTS for CI. For my Xamarin Android application during the build process it is trying to test the app on cloud, it's failing as it is not able to find nunit.framework.dll file in the project. I am using Nunit Version 2.6.4
The NuGets in the project are included in the output directory but still, I am getting the issue, can you please help me with it?
VSTS: Test Assembly Directory: Solution/Droid.UITests
Error:
Unable to find the nunit.framework.dll in the assembly directory. In Xamarin Studio you may have to right-click on the nunit.framework reference and choose Local Copy for it to be included in the output directory.

I got it. I had to remove the old references from the solution's nuget package collection.

Related

Azure Pipelines setup issues with .NET5 Specflow NUnit Project

Having an issue setting up an Azure Pipeline with my .Net5 Specflow NUnit project.
Those the list off jobs I currently have set up however as you can see I am getting an error in the build:
##[error]C:\Program Files\dotnet\sdk\5.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): Error NETSDK1005: Assets file 'D:\a\1\s\obj\project.assets.json' doesn't have a target for 'net5.0'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project.
I have checked my project file and the reference to net5.0 is in there.
It looks like that you didn't install the .NET 5 SDK on the build agents. You can use the .NET core task (https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops) to install it on your agent.
You should also update the NuGet client you are using in your pipeline. 4.4.1 is really old.

Cannot open microsoft.ai.machinelearning.h from NuGet package

I am working on a project in VS 2019 and am trying to use the latest winrt/c++ machine learning api. Therefore I conducted the following steps:
Install Microsoft.AI.MachineLearning 1.4.0 NuGet package for specific project
Build the project
Add #include "winrt/Microsoft.AI.MachineLearning.h"
Unfortunately, the header source file is not found. What am I doing wrong?
Cannot open microsoft.ai.machinelearning.h from NuGet package
When you install the nuget package Microsoft.AI.MachineLearning 1.4.0, you should use this
#include "abi/Microsoft.AI.MachineLearning.h"
Actually, Microsoft.AI.MachineLearning.h file exists under the abi folder from your nuget package.
================
Update 1
I have reproduced your issue in my side. And it seems that there is no such error in my side. I just create such project followed by the above document, then install that nuget package-->build the project and after that, I can call
`winrt/Microsoft.AI.MachineLearning.h.
And the winrt c++ project just puts such file into Generated Files folder during build process based on the function of the project.
So it is a quite strange behavior, and I suggest you could follow these steps to troubleshoot it:
Before all, you could check this document first.
1) First, close your Windows Console Application (C++/WinRT) project, delete .vs hidden folder, any output folders like Debug or Release under the solution folder and project folder.
2) Then restart your project and make sure that Microsoft.AI.MachineLearning 1.4.0 NuGet package is installed.
Then rebuild your project and make sure that build process is successful.
3) Then I can call #include "winrt/Microsoft.AI.MachineLearning.h".
If these steps do not help, I think VS or your current project itself has something wrong.
please try to disable any other third party extensions under Extensions-->Manage Extensions and then restart VS to test it.
Or just create a new WinRT C++ project to test whether the issue happens in the new project.

Why am I getting "File type is not supported" on TeamCity 9 when using NUnit 3?

I'm using TeamCity Enterprise 9.1.5 (build 37377).
I have created a Build Configuration.
I have created an NUnit Build Step.
For NUnit Runner I selected NUnit 3.
For Path to NUnit Console Runner I entered: packages\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe
In my Visual Studio solution I have installed the NUnit.Runner package.
When I run the Build Configuration I get the following error in the logs:
File type is not supported
How do I get my NUnit tests to run in TeamCity?
What worked for me:
I uninstalled NUnit.Runner and installed the following packages:
NUnit.ConsoleRunner
NUnit.Extension.NUnitProjectLoader
NUnit.Extension.TeamCityEventListener (not sure if this is needed, or not)
Why is the error being generated?
The ConsoleRunner can't handle .nunit files. That ability is part of NUnit.Extension.NUnitProjectLoader. The directory that extension is in will need to be listed as part of the .addins file. (I can't find the GitHub links where I found that information.)
How I troubleshooted:
TeamCity generated an .nunit file. I copied that file from the agent to my development machine to troubleshoot and run nunit3-console.exe myself. Once it ran on my development machine, TeamCity worked, too.

Building UWP apps on VSTS fails with MSBuild

I'm trying to set up CI builds for a Xamarin app using VSTS. The solution builds fine locally but in VSTS its failing on the build task on the UWP app. The android project builds fine in VSTS. As mentioned, everything builds and runs fine locally.
The only error I can see is:
##[error]Process 'msbuild.exe' exited with code '-1'.
Which doesn't help me much, when I look through the rest of the log file, which can be found here (I cant post it here as it doesn't format correctly and is unreadable)
According to the error logs, you are building a UWP project which target to "15063" SDK on a Hosted Build Agent while the Win10 SDK installed on Hosted Agent is 14393 which cause the error.
2017-04-27T14:48:04.8813251Z Could not use a link to copy "C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.15063.0\Windows.winmd" to "C:\a\1\s\MyProject\MyProject\MyProject.UWP\obj\x86\release\ilc\in\WinMetadata\Windows.winmd". Copying the file instead. Unspecified error
2017-04-27T14:48:04.8822945Z
2017-04-27T14:48:04.8822945Z 'MyProject.UWP' violates pattern constraint of '\bms-resource:.{1,256}'
The workaround is deploying your own build agent and install 15063 SDK on it.

Xamarin Studio 6 incompatible with NUnit 3.2.1

I've downloaded the latest copy of xamarin studio which is 6.0 build 3668. I've built a tiny console app and I'm trying to run some unit tests through the UI in xamarin, but I get a message saying that nunit 3.2.1 is unsupported. I have a fake script which does work when run in the terminal.
Full error message is here : Skipped loading assembly test because it references an unsupported version of the nunit.framework, 3.2.1.0.
Can anyone help please ?
I have also faced the problem: "Error CS0246: The type or namespace name 'NUnit' could not be found".
It's because the .dll file is not loaded in the references of the solution.
In my case, I am using Monodevelop/Xamarin Studio 7.8.4,
having multiple NUnit dlls in the monodevelop.UnitTest directory.
Duo to this reason, I had to add reference manually.
As I am using the Ubuntu 18.04 distribution, the nunit.framework.dll assembly was locketed at: usr/lib/monodevelop/Addins/MonoDevelop.UnitTesting/NUnit2/nunitframework.dll
So, I just added this assembly to the my project and the unit test was working fine.
Note: here I have added nunit.framework 2.6.4 assembly.

Resources