Git Product home page Git Product logo

Comments (9)

adamhathcock avatar adamhathcock commented on June 1, 2024

The bigger question is: what are you using that’s dependent on the preview bits?

from aspnetcore-realworld-example-app.

adamhathcock avatar adamhathcock commented on June 1, 2024

You should be using 2.1.1

from aspnetcore-realworld-example-app.

robeverett avatar robeverett commented on June 1, 2024

I agree, but last time I used 2.1.1, I ran into a dependency issue with a NuGet package that needed to target 2.1.0, so what is the 'best practice' when faced with such an issue ?

I need a stable set of NuGet dependencies that work together in a WebAPI project targeting asp.net core 2.1 along with entity framework core.

As a bonus I would love to know if it is possible (perhaps by editing the .csproj file) to target .net framework just for one or two assemblies that are not compatible with .net core.

I really don't want to break my app, by updating a nuget package only to find that there is the nuget equivalent of .net dll hell

from aspnetcore-realworld-example-app.

adamhathcock avatar adamhathcock commented on June 1, 2024

If you want an example of multi-targeting for a library you can look at my project here: https://github.com/adamhathcock/sharpcompress/blob/master/src/SharpCompress/SharpCompress.csproj

For libraries, you should be trying to target a netstandard and only resort to a .NET Core specific (e.g. netcoreapp2.0 or netcoreapp2.1) or full framework specific (e.g. net45) target for an executable. Sometimes it's unavoidable because they have other own specific APIs.

Again, I'd like to know your specific problem with dependencies to recommend more. Maybe read the docs here: https://docs.microsoft.com/en-us/dotnet/core/packages

from aspnetcore-realworld-example-app.

robeverett avatar robeverett commented on June 1, 2024

Ok, so if I delete the current NuGet packages and install the 2.1.1 current versions, will I risk breaking anything in my project ???

from aspnetcore-realworld-example-app.

robeverett avatar robeverett commented on June 1, 2024

The answer is YES, so thanks very much :(

PM> Install-Package Microsoft.AspNetCore.App -Version 2.1.1
Restoring packages for C:\Users\everettr\source\repos\OCM_API\OCM_API\OCM_API.csproj...
NU1608: Detected package version outside of dependency constraint: Microsoft.CodeAnalysis.CSharp.Workspaces 2.6.1 requires Microsoft.CodeAnalysis.CSharp (= 2.6.1) but version Microsoft.CodeAnalysis.CSharp 2.8.0 was resolved.
Install-Package : NU1107: Version conflict detected for Microsoft.CodeAnalysis.Common. Reference the package directly from the project to resolve this issue.
OCM_API -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.AspNetCore.Mvc.Razor 2.1.1 -> Microsoft.CodeAnalysis.CSharp 2.8.0 -> Microsoft.CodeAnalysis.Common (= 2.8.0)
OCM_API -> Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.0-preview1-final -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.0-preview1-final ->
Microsoft.VisualStudio.Web.CodeGeneration 2.1.0-preview1-final -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1.0-preview1-final ->
Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.0-preview1-final -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 2.1.0-preview1-final ->
Microsoft.VisualStudio.Web.CodeGeneration.Utils 2.1.0-preview1-final -> Microsoft.CodeAnalysis.CSharp.Workspaces 2.6.1 -> Microsoft.CodeAnalysis.Workspaces.Common 2.6.1 ->
Microsoft.CodeAnalysis.Common (= 2.6.1).
At line:1 char:1

  • Install-Package Microsoft.AspNetCore.App -Version 2.1.1
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
    

Install-Package : Package restore failed. Rolling back package changes for 'OCM_API'.
At line:1 char:1

  • Install-Package Microsoft.AspNetCore.App -Version 2.1.1
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
    

Time Elapsed: 00:00:02.1836939
PM>

from aspnetcore-realworld-example-app.

adamhathcock avatar adamhathcock commented on June 1, 2024

Looks like you're directly referencing Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.0-preview1-final which should be 2.1.1 as it exists here: https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/

from aspnetcore-realworld-example-app.

robeverett avatar robeverett commented on June 1, 2024

from aspnetcore-realworld-example-app.

adamhathcock avatar adamhathcock commented on June 1, 2024

NPM isn't much better. You can and do still run into transitive dependency issues when referencing an old package (which was your case). csproj and Nuget aren't as simple but they're not terrible either. I encourage you to do a diff on your new csproj vs the one that didn't work to understand what the issue was.

from aspnetcore-realworld-example-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.