[英]Missing netstandard 2.0 assembly error on blank Xamarin.Forms project
在 VS 中創建一個空白的 Xamarin.Forms 項目時出現錯誤,其中沒有引用 netstandard 程序集,並且我一生都無法弄清楚如何修復它。
我在應用程序中遇到的錯誤是:
我試過了,無濟於事:
<Reference Include="netstandard"/>
添加對請求的 netstandard 版本的<Reference Include="netstandard"/>
: https : //github.com/dotnet/standard/issues/542#issuecomment-344591026<Reference Include="System.IdentityModel"/>
到 csproj: https : //github.com/dotnet/standard/issues/542#issuecomment-501309019<TargetFramework>netstandard2.0</TargetFramework>
更改為<TargetFrameworks>netstandard2.0</TargetFrameworks>
如此<TargetFrameworks>netstandard2.0</TargetFrameworks>
建議: https : //github.com/dotnet/standard/issues/542#issuecomment-465375220這是我的 csproj(默認設置,注釋中建議的 AutoGenerateBindingRedirects 除外):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.908675" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="ViewModels\" />
</ItemGroup>
</Project>
任何人都知道該怎么做? 我發現的大多數答案要么不起作用,要么已經有好幾年了,並且據稱已使用較新的 VS 版本進行了修復。
這是我的詳細輸出日志的鏈接:
VS 社區 19 預覽: https : //privatebin.net/?c7c4cd6123e0edd7#5qYTwaKSyGKBMgU3beshk3Xgx52nyCyAYcsq63uRfWWT
VS 社區 19: https : //privatebin.net/?2cf9d7ab07e8a4fb#5UkwWhxKFPDGnTtVdZuawkQLMRNe4qvJLeuaBrFrPoJf
經過兩周的個人痛苦和與 Xamarin 經驗豐富的人共度 2 小時后發現了問題! 問題是我安裝了兩個不同版本的 dotnet(一個在 C: 驅動器中,另一個在我的 E: 驅動器中,我還保存了程序文件)。 在cmd中輸入dotnet --version
只看到它找到的版本是Ancient (1.x),然后dotnet --list-sdks
找到重復的版本。 刪除 E: 驅動器中的舊 SDK 並重新檢查我的 dotnet 版本后,錯誤消失了!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.