I have encountered a weird behavior with VS for Mac. This is how I repro it:
- Built a .NET Standard 2.0 NuGet package using VS2017. Package is called "MobileApps.Auth 1.0.0"
- Pushed the NuGet to our company NuGet server
- Switched over to the Mac and launched VS
- On the Mac; Built a Xamarin Forms app (shared project is also .NET Standard 2.0)
- Added reference to the .NET Standard 2.0 NuGet
ERROR:
Package MobileApps.Auth 1.0.0 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package MobileApps.Auth 1.0.0 supports:
- monoandroid81 (MonoAndroid,Version=v8.1)
- xamarinios10 (Xamarin.iOS,Version=v1.0)
I have zero clues as to why the NuGet would support monodroid81
and xamarinios10
. It's a .NET Standard 2.0 library that reference Xamarin.Forms
.
If I instead remain on the PC and run steps 4 and 5 in Visual Studio 2017 all is peachy.
This smells like a bug in VS for Mac. Has anyone else seen this?
Overall, having spent a few days building NuGet packages, based on .NET Standard 2.0, both on the Mac and PC I get the overall feeling this doesn't really work on the Mac. The reason I built the NuGet on VS2017 is because NuGet packs built on VS for Mac includes all kinds of facades that causes msbuild to fail due to conflicts (same identifiers found in multiple referenced assemblies).
[EDIT 1]
This is the NuGet layout when package built on VS4M:
_rels (empty folder)
[Content_Types].xml
lib
netstandard2.0
MobileApps.Auth.dll (my lib)
(+ 113 other dlls)
MobileApps.Auth.nuspec
package
services
metadata
core-properties
5bd1f861cd8a425f854c073a4a5f3e0e.psmdcp
And this is the NuGet layout when built on VS2017:
_rels
.rels
[Content_Types].xml
lib
netstandard2.0
MobileApps.Auth.dll (my lib)
MobileApps.Auth.nuspec
package
services
metadata
core-properties
5bd1f861cd8a425f854c073a4a5f3e0e.psmdcp
The difference is that VS4M includes 113 extra dlls in the netstandard2.0 folder while VS2017 doesn't. How can I control that?
[EDIT 2]
This is the .nuspec from within the .nupkg, built with VS4M:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>MobileApps.Auth</id>
<version>0.1.1</version>
<title></title>
<authors>Jonas Rembratt</authors>
<owners>Jonas Rembratt</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>bla bla</description>
<summary></summary>
<releaseNotes></releaseNotes>
<copyright></copyright>
<language></language>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="Xamarin.Forms" version="3.1.0.697729" />
<dependency id="System.ValueTuple" version="4.5.0" />
</group>
</dependencies>
</metadata>
</package>