Is Xamarin Forms .NET Standard 2.0 Already Supported?

We are trying to convert our PCL xamarin forms project to use .NET Standard 2.0. We are encountering an error during build in bitrise. Seems to be related to xamarin-archive step. Here is the log.

+------------------------------------------------------------------------------+

| (7) xamarin-archive@1.5.0                                                    |
+------------------------------------------------------------------------------+
| id: xamarin-archive                                                          |
| version: 1.5.0                                                               |
| collection: https://github.com/bitrise-io/bitrise-steplib.git                |
| toolkit: go                                                                  |
| time: 2017-11-19T16:34:26-08:00                                              |
+------------------------------------------------------------------------------+
|                                                                              |
INFO[16:34:26]  * [OK] Step dependency (go) installed, available. 
Configs:
- XamarinSolution: MyApp.sln
- XamarinConfiguration: Release
- XamarinPlatform: Any CPU
- ProjectTypeWhitelist: android,ios,macos,tvos
Experimental Configs:
- AndroidCustomOptions: 
- IOSCustomOptions: 
- TvOSCustomOptions: 
- MacOSCustomOptions: 
- BuildTool: msbuild
Other Configs:
- DeployDir: /Users/vagrant/deploy
Building all projects in solution: MyApp.sln
Building project: MyApp.Android
$ "/Library/Frameworks/Mono.framework/Versions/Current/Commands/msbuild" "/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" "/target:PackageForAndroid" "/p:SolutionDir=/Users/vagrant/git" "/p:Configuration=Release"
Microsoft (R) Build Engine version 15.4.0.0 (master/f296e67b Wed Oct 18 09:47:05 EDT 2017) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 11/19/2017 4:34:30 PM.
Project "/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" on node 1 (PackageForAndroid target(s)).
_CreatePropertiesCache:
  Creating directory "obj/Release/".
_SetLatestTargetFrameworkVersion:
   Found Android SDK. API levels: 10, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26
  Found Java SDK version 1.8.0.
_ValidateAndroidPackageProperties:
    PackageName: com.flg.kubofit
/Users/vagrant/git/MyApp/MyApp.Android/Properties/AndroidManifest.xml : warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '23' is less than $(TargetFrameworkVersion) 'v8.0'. Using API-26 for ACW compilation. [/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj]
ProcessGoogleServicesJsonChecks:
  No GoogleServicesJson file specified.
PrepareForBuild:
  Creating directory "bin/Release/".
Project "/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" (1) is building "/Users/vagrant/git/MyApp/MyApp/MyApp.csproj" (2:2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "bin/Release/netstandard2.0/".
  Creating directory "obj/Release/netstandard2.0/".
/usr/local/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '/Users/vagrant/git/MyApp/MyApp/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/vagrant/git/MyApp/MyApp/MyApp.csproj]
  Build continuing because "ContinueOnError" on the task "ReportAssetsLogMessages" is set to "ErrorAndContinue".
/usr/local/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '/Users/vagrant/git/MyApp/MyApp/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/vagrant/git/MyApp/MyApp/MyApp.csproj]
Done Building Project "/Users/vagrant/git/MyApp/MyApp/MyApp.csproj" (default targets) -- FAILED.
Done Building Project "/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" (PackageForAndroid target(s)) -- FAILED.
Build FAILED.
"/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" (PackageForAndroid target) (1) ->
(_ValidateAndroidPackageProperties target) -> 
  /Users/vagrant/git/MyApp/MyApp.Android/Properties/AndroidManifest.xml : warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '23' is less than $(TargetFrameworkVersion) 'v8.0'. Using API-26 for ACW compilation. [/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj]
"/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" (PackageForAndroid target) (1) ->
"/Users/vagrant/git/MyApp/MyApp/MyApp.csproj" (default target) (2:2) ->
(ReportAssetsLogMessages target) -> 
  /usr/local/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(323,5): error : Assets file '/Users/vagrant/git/MyApp/MyApp/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/vagrant/git/MyApp/MyApp/MyApp.csproj]
"/Users/vagrant/git/MyApp/MyApp.Android/MyApp.Android.csproj" (PackageForAndroid target) (1) ->
"/Users/vagrant/git/MyApp/MyApp/MyApp.csproj" (default target) (2:2) ->
(RunResolvePackageDependencies target) -> 
  /usr/local/share/dotnet/sdk/2.0.0/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file '/Users/vagrant/git/MyApp/MyApp/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/vagrant/git/MyApp/MyApp/MyApp.csproj]
    1 Warning(s)
    2 Error(s)
Time Elapsed 00:00:02.50
Build failed, error: exit status 1
|                                                                              |
+---+---------------------------------------------------------------+----------+
| x | xamarin-archive@1.5.0 (exit code: 1)                          | 7.01 sec |
+---+---------------------------------------------------------------+----------+
| Issue tracker: ...://github.com/bitrise-steplib/steps-xamarin-archive/issues |
| Source: https://github.com/bitrise-steplib/steps-xamarin-archive             |
+---+---------------------------------------------------------------+----------+

Thank you.

Hi @fitlg.mobile ,
thanks for the report! Do you have nuget-resote step before the xamarin-archive step in your workflow?

Yes sir, we have the following steps right before the xamarin archive step:
nuget-restore@1.0.4
xamarin-components-restore@0.9.0

I would need to have a look on your full build log, could you please contact us on bitrise on-site-chat, or share your build’s url here?

Here is the build url:

Thank you.

1 Like

I think the issue is nuget-restore step is still not using the new way of restoring nuget packages for Visual Studio 2017/.NET Standard 2.0 projects.

1 Like

Might be… From the build’s log (the one you linked above):

Currently running NuGet.exe 4.3.0.

What’s the NuGet version you use locally?

Also, did you try to do a clean git clone, into a new directory, on your own Mac, and run NuGet restore etc. from there? Does it work from there? (related guide: How to debug your build locally / "It works on my Mac/PC but not on bitrise.io" )