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 #1025

Closed
cpistiner opened this issue May 8, 2019 · 9 comments
Closed
Labels

Comments

@cpistiner
Copy link

I just updated (via NUGET) the version of FluentMigrator from 1.6.2 to 3.2.1 and well in my local environment I have no problems (beyond the necessary adaptations for the version change) when integrating the changes to the server I am receiving the message:

The type 'System.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'.

I have tried many solutions but the error persist.

I'm not sure it's a specific Fluent problem, but if you have any ideas, it's welcome.

Regards,
César

@jzabroski
Copy link
Collaborator

@cpistiner Which MSBuild .csproj project type are you using? Are you using csproj Classic format or the Microsoft.Net.Sdk project format?

@jzabroski
Copy link
Collaborator

Also, what .NET Framework version or .NET Core Runtime are you running locally vs. on your server?

For .NET Core Runtime, not sure if you're aware, but it's easy to see which versions of .NET Core are installed on our machine.

@jzabroski
Copy link
Collaborator

In dotnet/standard#542 there are two suggestions:

  • Check your Visual Studio version. Visual Studio 2017 15.4.4 contained a bug that was fixed in later versions - the code would work fine if you had the right MSBuild tool and SDK installed, but Visual Studio would fail
  • Add the following in your csproj:
    <ItemGroup>
      <Reference Include="netstandard" />
    </ItemGroup>

Separately, as suggested:

  • Report what csproj file format you are using
  • Report what dotnet runtime you are building against
    • Is the runtime Core or Framework?
    • What version number for the given Core or Framework runtime?

@cpistiner
Copy link
Author

MSBuild

Hi @jzabroski !

Thanks for your reply.

In localhost i have MSBuild 15.0 but the app is running in Windos Server 2012 and builds with MSBuil 14.0.

@cpistiner
Copy link
Author

Also, what .NET Framework version or .NET Core Runtime are you running locally vs. on your server?

For .NET Core Runtime, not sure if you're aware, but it's easy to see which versions of .NET Core are installed on our machine.

4.6.1

@jzabroski
Copy link
Collaborator

This footnote / warning in the MS Docs might help you:

2 The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

Source: https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support

@cpistiner
Copy link
Author

In dotnet/standard#542 there are two suggestions:

  • Check your Visual Studio version. Visual Studio 2017 15.4.4 contained a bug that was fixed in later versions - the code would work fine if you had the right MSBuild tool and SDK installed, but Visual Studio would fail
  • Add the following in your csproj:
    <ItemGroup>
      <Reference Include="netstandard" />
    </ItemGroup>
    

Separately, as suggested:

  • Report what csproj file format you are using

  • Report what dotnet runtime you are building against

    • Is the runtime Core or Framework?
    • What version number for the given Core or Framework runtime?

At this moment i have Visual Stuidio Community 2019.

csproj file format? This?

The solution is running with NET Framework 4.6.1.

I already tried that but unfortunately it did not work


I thank you very much for the help, I hope that with this information we will find the solution.

Regards,
César

@cpistiner
Copy link
Author

This footnote / warning in the MS Docs might help you:

2 The versions listed here represent the rules that NuGet uses to determine whether a given .NET Standard library is applicable. While NuGet considers .NET Framework 4.6.1 as supporting .NET Standard 1.5 through 2.0, there are several issues with consuming .NET Standard libraries that were built for those versions from .NET Framework 4.6.1 projects. For .NET Framework projects that need to use such libraries, we recommend that you upgrade the project to target .NET Framework 4.7.2 or higher.

Source: https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support

Excelent this, I migrated to 4.7.2 and commented how it was!!

Thank you very much!

@jzabroski
Copy link
Collaborator

MSBuild

Hi @jzabroski !

Thanks for your reply.

In localhost i have MSBuild 15.0 but the app is running in Windos Server 2012 and builds with MSBuil 14.0.

MSBuild 14.0 likely does not support metapackages, or does not support metapackages at the same level as MSBuild 15.0 - I think you need to upgrade your build server, but first take a VM snapshot before following such destructive suggestions, so that if it fails, you can just rollback the snapshot.

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

No branches or pull requests

2 participants