Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

You must add a reference to assembly netstandard, Version=2.0.0.0 #860

Closed
rosieks opened this issue Aug 17, 2017 · 21 comments
Closed

You must add a reference to assembly netstandard, Version=2.0.0.0 #860

rosieks opened this issue Aug 17, 2017 · 21 comments

Comments

@rosieks
Copy link

rosieks commented Aug 17, 2017

Hi,
I have created new asp.net core application that's based on .NET Framework 4.6.1 and it doesn't build on my build server. Below is error message that I receive:

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'.

What should I do to solve that issue?

@samcov
Copy link

samcov commented Aug 18, 2017

I have a 100% .net core 2.0 project, originally 1.1, and I'm getting something similar.

Error CS0012 The type 'DbConnection' 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'.

@samcov
Copy link

samcov commented Aug 18, 2017

I just noticed that switching to 2.0 didn't upgrade the csproj, it looks like this,

<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>

Should I just change it there, or is there a way to do it in VS2017?

@ousiax
Copy link

ousiax commented Aug 18, 2017

hi @rosieks

I have a similar problem, and I remove the RuntimeFrameworkVersion, and the problem was fixed.

Try to remove <RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion> or <NetStandardImplicitPackageVersion section in the csproj.

@rosieks
Copy link
Author

rosieks commented Aug 18, 2017

I have that problem for project that target version 2.0 from beginning.

@samcov
Copy link

samcov commented Aug 18, 2017

@qqbuby - I didn't see your response, so I just replaced the old version with 2.0.0 and everything worked.

However, if what you said is true, maybe those sections are no longer needed, but if there, must target the correct version.

Either way, people upgrading will likely be confused because the process misses those things.

@rosieks
Copy link
Author

rosieks commented Aug 18, 2017

It looks like build server just lack Visual Studio 15.3

@diegofal
Copy link

@qqbuby this didn't work for me, and I am still being asked to add a reference. Is anybody still experiencing this during upgrade?

@ousiax
Copy link

ousiax commented Sep 13, 2017 via email

@redwards510
Copy link

What is the solution for this? I'm getting it in lots of projects now. For example, https://github.com/Arch/UnitOfWork is supposed to work with netcore 20. When I clone and build that repo, it complains about references to System.Data and System.Text.RegularExpressions as well as DbConnection. ex:

Severity Code Description Project File Line Suppression State
Error CS0012 The type 'DbConnection' 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'. Microsoft.EntityFrameworkCore.UnitOfWork C:\Users\redwards\Downloads\UnitOfWork-2.0.1\src\Microsoft.EntityFrameworkCore.UnitOfWork\UnitOfWork.cs 48 Active

@risurina
Copy link

Add System.Data to your reference. It solve my problem.

@sudheerah
Copy link

I had the same issue and when I upgraded VS2017 Enterprises IDE to version 15.5.5 it has been resolved magically.

@masaab
Copy link

masaab commented Jan 29, 2018

this code worked for me

<ItemGroup>
   <PackageReference Update="Microsoft.NETCore.App" Version="2.0.0" />
 </ItemGroup>

@vs6681
Copy link

vs6681 commented Feb 9, 2018

I am still facing the same issue even after adding the

OR 2. 1.0.4 removed in csproj file. OR 2. OR 3.

Any help ??

SeanFeldman added a commit to SeanFeldman/service-bus-dotnet-management that referenced this issue Feb 22, 2018
fixes issue dotnet/core#860 as a result of RuntimeFrameworkVersion set incorrectly
@narinderparmar
Copy link

narinderparmar commented Mar 7, 2018

solution that worked for me "upgrading target framework to 4.7.1"
with out changing any other configuration

vinaysurya pushed a commit to Azure-Samples/service-bus-dotnet-management that referenced this issue Mar 22, 2018
fixes issue dotnet/core#860 as a result of RuntimeFrameworkVersion set incorrectly
@akagGt
Copy link

akagGt commented Mar 29, 2018

I have created a new asp.net standard Library that is based on .NET Framework 4.6.2 and it doesn't build on my build server. Below is error message that I receive the same error:
You must add a reference to assembly netstandard

@QtRoS
Copy link

QtRoS commented Sep 4, 2018

In my case the same issue was caused by xUnit - it turned out that xUnit requires .NET Core build tools. More details in this answer.

@kamalkumar1
Copy link

I having same issue while running uwp Xamarin project in windows emulator

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'.

@AdilTalkpool
Copy link

you are targeting different version of dll In my case the error was

Error CS0012 The type 'Task<>' 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'. EboIotEdgeConnector.Extension D:\projects\EboIoTEdgeConnector-master\EboIotEdgeConnector.Extension\RetainedMqttMessageHandler.cs

I ) change the IMqttServerStorage to MQTTnet.Server.IMqttServerStorage
2) remove the reference and of net461 version and add the reference from
\packages\MQTTnet.2.8.4\lib\netstandard2.0
Rebuild the solution the issue will be resolved

@jigarce
Copy link

jigarce commented Jan 22, 2019

hi @rosieks

I have a similar problem, and I remove the RuntimeFrameworkVersion, and the problem was fixed.

Try to remove <RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion> or <NetStandardImplicitPackageVersion section in the csproj.

Thanks

@fengbujue2022
Copy link

the same problem with teamcity build

@pedasmith
Copy link

I just solved a similar problem when I imported a VS2015 UWP C# app into VS2019 and added the UWP Community toolkit. The solution (apart from my other dinking around) was to set the C# compiler from from "MOST RECENT" (which may have told it to use c# 8.0 (beta) and instead forced the project to compile using C# 7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests