所以我一直在嘗試做一個項目,將使用netstandard類庫通用代碼,但是我一直不成功,因爲我一直在遇到錯誤。我一直在關注如何在這裏發佈https://oren.codes/2016/07/09/using-xamarin-forms-with-net-standard/和https://xamarinhelp.com/dot-net-standard-pcl-xamarin-forms/。他的示例我可以下載並運行良好,但是當我嘗試使用他的指令複製它時,我遇到了錯誤錯誤,當試圖與Xamarin形式使用netstandard
您的項目未引用「.NETPortable,Version = v4.5,Profile = Profile111」框架。在project.json的「frameworks」部分中添加對「.NETPortable,Version = v4.5,Profile = Profile111」的引用,然後重新運行NuGet恢復。 FixMyCity.Mobile C:\ Program Files(x86)\ MSBuild \ Microsoft \ NuGet \ Microsoft.NuGet.targets 140
我知道這聽起來很明顯;只需添加.NETPortable,Version=v4.5,Profile=Profile111
在project.json的框架部分,但後來我得到這個錯誤(80%肯定它是由在加入它,因爲它不存在以其他方式)
包含的MSBuild目標的軟件包和道具文件無法完全安裝在針對多個框架的項目中。 MSBuild目標和道具文件已被忽略。 ... project.nuget.targets
而且當我在看樣品的項目,他不針對.NETPortable,Version=v4.5,Profile=Profile111
,它工作正常
這是我與它到目前爲止,如果你得到的最接近想看看:https://github.com/Toxicable/XamarinFormsNetstandardIssue
這只是模板項目(Xamrin形式protalble)與步驟下方施加
- 運行`PM>卸載,包裝xamarin.forms -Force -RemoveDependencies在每個項目上; IOS和Andriod首先是PCL。
- 重啓VS通過控制檯提示
- 添加在
project.json
每個項目如下 - 嘗試構建,但也它不會
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": {}
}
}
項目.Driod project.json
{
"dependencies": {
},
"frameworks": {
"MonoAndroid,Version=v6.0": {
}
},
"runtimes": {
"win": {}
}
}
project.iOS project.json
{
"dependencies": {
},
"frameworks": {
"Xamarin.iOS,Version=v1.0": {
}
},
"runtimes": {
"win": {}
}
}
你見過票據參考1? https://releases.xamarin.com/beta-release-cycle-7-service-release-1-updated/ 這些構建引入了與新的.NET標準1.6的兼容性。這尤其允許開發人員使用已針對.NET Standard 1.6構建的NuGet包。 –
@JonDouglas我已經看到,我不確定與我的問題有什麼關係,即時通訊瞄準低網絡標準,因爲它是最兼容的,但會改變到我能夠瞄準iOS和Andriod的最高水平,我認爲這是1.6一旦項目真正建立起來 – Toxicable