The type [Type] exists in both [Assembly1] and [netstandard 2.0 assembly]

This issue can still happen even with DOT NET Core 2+, and is caused when the packages you reference in your project depend on a different version of the same package, specifically same namespace.

There are 2.5 solutions that I know of:

1) If you control both packages, then update both to make sure they are using the same version of that dependency (or change the namespace of one of the versions of that dependency, like: Your.Thing.v3.Models)

2) If you can find one or both of those packages on an open source site like GitHub, you can download them and update them to use the same version of that dependency (or the namespace thing from option 1, above)

2.5) If you don't control or have access to the source of those packages, and I realize that this isn't really a solution... (hence the .5), then the last option is to stop using one of those packages.

If there's another way, I'd love to know about it.


Update: Visual Studio 2017 15.3 and the 2.0.0 SDK have been released. Use these versions to get rid of such conflicts.

This appears to be one of the build issues happening when using a mix of preview-tooling and "RTM" packages before all parts have been released.

To get the best support for 2.0.0 at the time of writing, do one of the following:

  • only use the same preview2 version of the nuget packages, the installed .NET Core SDK and the latest VS 2017 15.3 preview (15.3 Preview 7).

  • Use the latest VS 2017 15.3 Preview (Preview 7), install the 2.0.0 (not preview2) .NET Core Sdk from the CI build output at https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.0.0/dotnet-sdk-2.0.0-win-x64.exe (the same build output location is used by microsoft's 2.0.0 docker images)

The reason for this requirement is that the 2.0.0 SDK knows about these conflicts and trims the conflicting references (System.*.dll in this case) out of the projects.