Closed workgroupengineering closed 3 years ago
Have you tried adding a reference to netstandard 2.1.0.0
, as suggested?
I edited the project file as you suggested and now it works.
I think it is better to add targets to library without adding trick.
<Project Sdk="MSBuild.Sdk.Extras" ToolsVersion="15.0">
<PropertyGroup>
<TargetFrameworks>netstandard2.1;xamarinmac20;xamarinios10;MonoAndroid11.0;MonoAndroid10.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="2.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'xamarinmac20'">
<Reference Include="netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</ItemGroup>
</Project>
This is not a trick. This is how it works.
You can get the same for .NET Standard on other targets.
Adding those targets to the library is not the solution. Otherwise, we should add them all. That's what .NET Standard is for. To avoid all that.
Hi, I think it is a trick because adding the reference is not possible from the ide and only those who know a little about how msbuild ItemGroup work can solve it easily.
Hi, I think it is a trick because adding the reference is not possible from the ide and only those who know a little about how msbuild ItemGroup work can solve it easily.
That would be a shortcoming of the IDE.
Which IDE are you using?
Microsoft Visual Studio Community 2019 Version 16.9.4
You should report that through "Report a problem".
Current behavior
When using RecyclableMemoryStream in a Tartget target project, the compiler reports the following errors:
Aspected behavior
should compile without errors.
Environment:
Visual Studio: Visual Studio Community 2019 Build 16.9.4+31205.134 RecyclableMemoryStream Version: 2.0.0