Struggling with getting a Xamarin project with .NET Standard project to build

Bitrise Build Issue Report template

Description of the issue

I have a Xamarin-project that build an iOS and an Android app. The core project today is PCL and it builds just fine on Bitrise.

When I change the core project to a .NET Standard project (2.0) it compiles and runs locally on both Visual Studio on WIndows and Visual Studio on Mac. But building with Bitrise fails.

Visual Studio for Mac Installer appears to install dot net core 2.0 component automatically when you do a clean install today but as far as I can see dot net core is missing in the VM - and that breaks the build.

If you get the xamarin-archive step to build your solution using the workaround you run into the next issue. The NUnit test runner fails because it is using an outdated version of nunit3-console.exe that does not support dotnet standard projects. I think nunit3-console.exe also a part that is installed into osx-vs4mac-stable VM and you should refresh it to use the latest version.

Workaraound

To verify that this is the case I added a script step and downloaded and run “dotnet-install.sh --channel 2.0”. Just to be safe I also throw in a “dotnet restore” but that should not be needed when running core 2.

(The existing step to install dotnet core that you can find through the workflow editor is broken and should be removed since it is not maintained)

Environment

Stack: osx-vs4mac-stable (and beta)

Build Step: xamarin-archive (1.5.0)
Build Step: steps-nunit-runner (1.4.0)

Reproducibility

  • Rebuild does NOT help. Same result every time.
  • Adding/removing cache has no effect.
  • Problem started when introducing .NET Standard projects into solution.

Build log

We re-install VS for Mac for every Xcode update - the next one will happen this weekend; VS for Mac will be installed on top of the Xcode 9.1 stack.

Changelog is coming soon - will be in Changelog if you’re interested - and as usual we’ll deploy it during the weekend (usually on Saturday).

If that wouldn’t help just let us know! :slight_smile:

Ohh and huge thanks for the workaround! I’m sure it’ll help others in the meantime and possible in the future too :wink:

Complete re-install of Visual Studio for Mac on the Xcode 9.1 stack went live this weekend (Weekly Virtual Machine / Stack updates - 2017.11.11 - Xcode 9.2 beta 2, VS for Mac reinstall on Xcode 9.1 stack).

Can you please try it again @fredrikhaglund and let us know if you’d still have this issue?
Thanks! :slight_smile:

@viktorbenei Thanks!

It looks like dotnet core is installed now so no extra step to manually download and install it is required anymore.

NUnit runner step still fails. It does compile the unit test projects now but fail to execute tests with the following error:

Failed to read test result, error: test result not exist at: /Users/vagrant/deploy/TestResult.xml
Test run failed, error: No project to build found

Log files from build here:

Thanks for confirming @fredrikhaglund - I’ll have an engineer look at the NUnit issue ASAP :slight_smile:

@fredrikhaglund we checked your log and it seems that NuGet simply does not generate the test results, or at least not at the path where it’s expected.

If you still have this issue can you please:

  1. Follow the local debugging guide (How to debug your build locally / "It works on my Mac/PC but not on bitrise.io"), at least the first section, and see if you get the same result locally (that NuGet does not generate the test report for the config you specified)
  2. If that wouldn’t help, fill out a new #issues:build-issues report.

Of course if you have any questions feel free to ask! :slight_smile:

Just one more note: you can see the full command performed by the NUnit step in the step’s log, $ "/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild" ...

Hi @fredrikhaglund

Could you please attach your solution file (Ticket.Client.sln)? It seems like the NUnit tests are not selected by the configuration (Beta) and platform (Any).

1 Like

I’m closing this issue, we can do further investigation on it if the solution file is provided.

I am having the exact same problem. I have a .NET Core 2.0 unit test project and a .NET Standard class library, and I also get the “Test run failed, error: No project to build found” error.

Not sure if this is related, but I picked up an issue with Xamarin Studio 7.4.4 which you can read about here:

https://developercommunity.visualstudio.com/content/problem/196706/running-nunit-tests-against-net-standard-assembly.html

It seems that there is a bug in the beta version of XS. I switched back to stable channel and they started running locally on XS and VS, but now I can’t get it to run on bitrise.

PS My build stack on bitrise is set to the stable channel.

Guys this is still an issue, can you please take a look at it.

@viktorbenei @kdobmayer You can try this repo:

It has two simple solutions with a .NET Core unit test project. I’ve tried to get bitrise to run the tests with the nunit runner step but the same problem persists.

What’s the issue/error? The “Test run failed, error: No project to build found” one?
In which step/command you get this?
Can you please share the link of the related bitrise.io build?

That’s correct. The error is:

Failed to read test result, error: test result not exist at: /Users/vagrant/deploy/TestResult.xml
Test run failed, error: No project to build found

To replicate this for you I created a brand new solution with only one project and one test. It runs fine on my machine. On bitrise it fails.

Here is the test solution:

Here is the Bitrise build (note I had to do a dotnet restore in a script to make it build):

Any assistance would be appreciated. I can’t run unit tests on any Xamarin apps that have migrated from PCL to .NET Standard.

Can you please clarify a bit what you mean by “it runs fine on my machine”? What commands do you run there? Did you try to run it via Bitrise CLI?

I mean I can run the tests using visual studio. On my machine.

Hello I have the same issue, 1 year later and I cannot find any solution, do you guys have a fix for this? Can you run Nunit step with .netstandard projects?

Just started a brand new project and thought I’d give bitrise another try but nunit tests are still not being run by the Nunit Runner step.

Hi @freever and @15mgm15!

Sorry about all of this. Could you share with us some build logs (build URLs) and details we could conclude an investigation based on?

No problem. I set up a test repo and bitrise workflow a long time ago to repro this, and it still fails, so I hope the repro is still relevant: