1
votes

I am converting my PCL project to .Net Standard project using this article. But getting the following error when building.

I try adding netstandard reference like below from this thread, but no luck.

  <ItemGroup>
    <Reference Include="netstandard" />
  </ItemGroup>
  <ItemGroup>

Complete Error Details

Severity Code Description Project File Line Suppression State Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

Please suggest any solution to this problem?

I didn't find netstandard reference on there, is it have any other name? screenshot of my reference manager added below.

enter image description here

Initialy, I got another error from windows part. Error details:

Severity Code Description Myproject File Line Suppression State Error NU1201 Project Myproj is not compatible with uap10.0.10586 (UAP,Version=v10.0.10586) / win10-arm-aot. Project Myproject supports: netstandard2.0 (.NETStandard,Version=v2.0) Myproject.UW

Choosing the Windows 10 Fall Creators Update for both Target and Min version for my UWP app solved the above problem. I got this from here. Is that fix affect the current error?

1
why do you edit the csproj. Can't you add it via "add Reference" ?Felix D.
also, the warning in your image clearly says that your changes to the csproj are not correct !Felix D.
@FelixD. netstandard is not available in reference manager, I edited the question with a screenshot.Sreejith Sree
@FelixD. Actualy I am converting the PCL project to .Net standard project, I followed the steps on the article by Montemagno. montemagno.com/…Sreejith Sree
Well it says add the packages so did you add all the packages back?FreakyAli

1 Answers

1
votes

You are not referencing the package correctly,

Delete your csproj, it should look look like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <!--<PackageReference Include="" Version=""/>-->
  </ItemGroup>

</Project>

And after this, go to open packages.config, and add the package references above,

<PackageReference Include="YourPackageName" Version="XYZ"/>

The last step, delete AssemblyInfo.cs and packages.config

If this doesn't work, and if you are using Visual studio for Mac you can use Mutatio

The last available option is to create a brand new project, netstandard and the copy the classes and files from your old one.