So I've been trying to make a project that will use netstandard class libraries common code however I have been unsuccessful as I keep running into errors. I have been following the post here https://oren.codes/2016/07/09/using-xamarin-forms-with-net-standard/ and https://xamarinhelp.com/dot-net-standard-pcl-xamarin-forms/ on how to do it. His sample I can download and run fine but when I try replicate it with his instructions I run into the error
Your project is not referencing the ".NETPortable,Version=v4.5,Profile=Profile111" framework. Add a reference to ".NETPortable,Version=v4.5,Profile=Profile111" in the "frameworks" section of your project.json, and then re-run NuGet restore. FixMyCity.Mobile C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets 140
Which I know it sounds obvious; just add .NETPortable,Version=v4.5,Profile=Profile111
in the frameworks section of project.json but then I get this error (80% certain it's caused by adding it in since it's not there otherwise)
Packages containing MSBuild targets and props files cannot be fully installed in projects targeting multiple frameworks. The MSBuild targets and props files have been ignored. ...project.nuget.targets
Also when I look at the sample project, he does not target .NETPortable,Version=v4.5,Profile=Profile111
and it works fine
This is the closest I've gotten with it so far if you would like to take a look: https://github.com/Toxicable/XamarinFormsNetstandardIssue
It's just the template project (Xamrin forms protalble) with the steps below applied
- Run `PM> Uninstall-Package xamarin.forms -Force -RemoveDependencies on each project; IOS and Andriod first PCL last.
- Restart VS as prompted by console
- Add in
project.json
to each project as below - Try build but well it wont
PCL project.json
{
"supports": {},
"dependencies": {
"Xamarin.Forms": "2.3.0.107",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.1": {
"imports": "portable-net45+win8+wpa81+wp8"
},
".NETPortable,Version=v4.5,Profile=Profile111": {}
}
}
project.Driod project.json
{
"dependencies": {
},
"frameworks": {
"MonoAndroid,Version=v6.0": {
}
},
"runtimes": {
"win": {}
}
}
project.iOS project.json
{
"dependencies": {
},
"frameworks": {
"Xamarin.iOS,Version=v1.0": {
}
},
"runtimes": {
"win": {}
}
}