[英]Missing netstandard 2.0 assembly error on blank Xamarin.Forms project
I'm getting an error when creating a blank Xamarin.Forms project in VS where the netstandard assembly isn't being referenced, and cannot for the life of me figure out how to fix it.在 VS 中创建一个空白的 Xamarin.Forms 项目时出现错误,其中没有引用 netstandard 程序集,并且我一生都无法弄清楚如何修复它。
The errors I'm getting in the app are:我在应用程序中遇到的错误是:
I have tried, to no avail:我试过了,无济于事:
<Reference Include="netstandard"/>
as suggested here: https://github.com/dotnet/standard/issues/542#issuecomment-344591026<Reference Include="netstandard"/>
添加对请求的 netstandard 版本的<Reference Include="netstandard"/>
: https : //github.com/dotnet/standard/issues/542#issuecomment-344591026<Reference Include="System.IdentityModel"/>
to the csproj as suggested here: https://github.com/dotnet/standard/issues/542#issuecomment-501309019<Reference Include="System.IdentityModel"/>
到 csproj: https : //github.com/dotnet/standard/issues/542#issuecomment-501309019<TargetFramework>netstandard2.0</TargetFramework>
to<TargetFramework>netstandard2.0</TargetFramework>
更改为<TargetFrameworks>netstandard2.0</TargetFrameworks>
as suggested here: https://github.com/dotnet/standard/issues/542#issuecomment-465375220 <TargetFrameworks>netstandard2.0</TargetFrameworks>
如此<TargetFrameworks>netstandard2.0</TargetFrameworks>
建议: https : //github.com/dotnet/standard/issues/542#issuecomment-465375220 This is my csproj (default with the exception of the AutoGenerateBindingRedirects, which was suggested in the comments):这是我的 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>
Anyone have any idea what to do about this?任何人都知道该怎么做? Most of the answers I've found either don't work or are several years old and are alleged to have been fixed with newer VS versions.
我发现的大多数答案要么不起作用,要么已经有好几年了,并且据称已使用较新的 VS 版本进行了修复。
Here's a link to my detailed output logs:这是我的详细输出日志的链接:
VS Community 19 Preview: https://privatebin.net/?c7c4cd6123e0edd7#5qYTwaKSyGKBMgU3beshk3Xgx52nyCyAYcsq63uRfWWT VS 社区 19 预览: https : //privatebin.net/?c7c4cd6123e0edd7#5qYTwaKSyGKBMgU3beshk3Xgx52nyCyAYcsq63uRfWWT
VS Community 19: https://privatebin.net/?2cf9d7ab07e8a4fb#5UkwWhxKFPDGnTtVdZuawkQLMRNe4qvJLeuaBrFrPoJf VS 社区 19: https : //privatebin.net/?2cf9d7ab07e8a4fb#5UkwWhxKFPDGnTtVdZuawkQLMRNe4qvJLeuaBrFrPoJf
Found the problem after two weeks of personal suffering and 2 hours spent with someone experienced with Xamarin!经过两周的个人痛苦和与 Xamarin 经验丰富的人共度 2 小时后发现了问题! The issue was that I had two different versions of dotnet installed (one in the C: drive and one in my E: drive where I also keep program files).
问题是我安装了两个不同版本的 dotnet(一个在 C: 驱动器中,另一个在我的 E: 驱动器中,我还保存了程序文件)。 Entered
dotnet --version
in cmd only to see that the version it found was Ancient (1.x), and then dotnet --list-sdks
to find the duplicate one.在cmd中输入
dotnet --version
只看到它找到的版本是Ancient (1.x),然后dotnet --list-sdks
找到重复的版本。 After deleting the old SDK in the E: drive and rechecking my dotnet version the error vanished!删除 E: 驱动器中的旧 SDK 并重新检查我的 dotnet 版本后,错误消失了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.