I have an existing ASP.NET project and it's not in MVC. When I try to install Hangire I get this error.
PM> Install-Package Hangfire
Attempting to gather dependency information for package 'Hangfire.1.5.8' with respect to project 'FYMAS', targeting '.NETFramework,Version=v4.0'
Attempting to resolve dependencies for package 'Hangfire.1.5.8' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Hangfire.1.5.8'
Resolved actions to install package 'Hangfire.1.5.8'
Adding package 'Newtonsoft.Json.5.0.1' to folder 'C:\Users\User\Desktop\hang\packages'
Added package 'Newtonsoft.Json.5.0.1' to folder 'C:\Users\User\Desktop\hang\packages'
Added package 'Newtonsoft.Json.5.0.1' to 'packages.config'
Successfully installed 'Newtonsoft.Json 5.0.1' to FYMAS
Install failed. Rolling back...
Package 'Hangfire.Core.1.5.8 : Newtonsoft.Json [5.0.0, ), Owin [1.0.0, )' does not exist in project 'FYMAS'
Removed package 'Newtonsoft.Json.5.0.1' from 'packages.config'
Package 'Hangfire.Core.1.5.8 : Newtonsoft.Json [5.0.0, ), Owin [1.0.0, )' does not exist in folder 'C:\Users\User\Desktop\hang\packages'
Removing package 'Newtonsoft.Json.5.0.1' from folder 'C:\Users\User\Desktop\hang\packages'
Removed package 'Newtonsoft.Json.5.0.1' from folder 'C:\Users\User\Desktop\hang\packages'
Install-Package : Could not install package 'Hangfire.Core 1.5.8'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package
does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Hangfire
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I tried to install owin to my project using Install-Package Owin command, this installation is success but when I try to install hanfire again, I got the same error. I tried installing an older version of hangfire using Install-Package HangFire -Version 1.4.6, but got the same error.
It seems your problem is your .NET framework, you are using 4.0, then you should install hangfire for your framework, try this
Install-Package Hangfire_net40
When you use Install-Package Hangfire, this will install the latest stable version (in your case Hangfire.1.5.8, this requires newer .net framework ~ 4.5). For more details, Hangfire (.Net 4.0) 1.1.1
Related
I have added the reference to my project.csproj file as indicated on S.O. and in the ms docs tutorial:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
</ItemGroup>
running dotnet restore claims to succeed. But the dotnet aspnet-codegenerator command can't be found and in the manage nuget packages, the CodeGeneration.Tools isn't installed and manually installing gives the error:
Package restore failed. Rolling back package changes for 'ContosoUniversity'.
This appears to be from a version compatibility issue that I don't understand or know how to fix. I have installed in my dependencies Microsoft.NETCore.App 2.0.3
and Microsoft.NETCore.APP 2.0.3 and everything else is 2.0.1. (CodeGeneration.Design, CodeGeneration.Utils etc... and running at Package Management Console Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools Throws the error:
GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.web.codegeneration.tools/index.json
OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.visualstudio.web.codegeneration.tools/index.json 166ms
Restoring packages for C:\Users\sticker592\Documents\Visual Studio 2017\Projects\ContosoUniversity\ContosoUniversity\ContosoUniversity.csproj...
Install-Package : Detected package downgrade: Microsoft.NETCore.App from 2.0.3 to 2.0.0. Reference the package directly from the project to
select a different version.
ContosoUniversity -> Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.1 -> Microsoft.NETCore.App (>= 2.0.3)
ContosoUniversity -> Microsoft.NETCore.App (>= 2.0.0)
At line:1 char:1
+ Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package : Package restore failed. Rolling back package changes for 'ContosoUniversity'.
At line:1 char:1
+ Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Downgrading everything to 2.0.0 allows me to install CodeGeneration.Tools in Nuget but I still get the error: dotnet : No executable found matching command "dotnet-aspnet-codegenerator"
Go to "Manage Nuget Package for solution" in Nuget Package Manager and
In Package Source
.
Add below detail:
Name
"nuget.org"
source
"https://api.nuget.org/v3/index.json"
If this happens, the solution to the error is to run the command at the dos command prompt in the project folder directory instead of in Package manager console. Then you can scaffold your pages without the error until MS fixes this bug.
Proof:
C:\Users\username\Documents\Visual Studio 2017\Projects\ContosoUniversity\ContosoUniversity>dotnet aspnet-codegenerator razorpage -m Student -dc SchoolContext -udl -outDir Pages\Students --referenceScriptLibraries
Building project ...
Finding the generator 'razorpage'...
Running the generator 'razorpage'...
Attempting to compile the application in memory.
Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Student'
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\username\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
info: Microsoft.EntityFrameworkCore.Infrastructure[100403]
Entity Framework Core 2.0.0-rtm-26452 initialized 'SchoolContext' using provider 'Microsoft.EntityFrameworkCore.SqlServer' with options: None
Added Razor Page : \Pages\Students\Create.cshtml
Added PageModel : \Pages\Students\Create.cshtml.cs
Added Razor Page : \Pages\Students\Edit.cshtml
Added PageModel : \Pages\Students\Edit.cshtml.cs
Added Razor Page : \Pages\Students\Details.cshtml
Added PageModel : \Pages\Students\Details.cshtml.cs
Added Razor Page : \Pages\Students\Delete.cshtml
Added PageModel : \Pages\Students\Delete.cshtml.cs
Added Razor Page : \Pages\Students\Index.cshtml
Added PageModel : \Pages\Students\Index.cshtml.cs
RunTime 00:00:15.33
I'm trying to write a simple phone app using UWP that will insert an image from a Windows folder location into a table on SQLite and view it on the Windows phone.
I found this article on technet forum that I am using for a reference:
https://social.technet.microsoft.com/wiki/contents/articles/37975.save-and-load-images-in-universal-windows-app-with-sqlite-and-entity-framework-core.aspx
While following the instructions, I ran into an issue in installing the package Microsoft.EntityFrameworkCore.Tools (latest stable ver.2.0.1):
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
GET https://api.nuget.org/v3/registration3-gz/microsoft.entityframeworkcore.tools/index.json
OK https://api.nuget.org/v3/registration3-gz/microsoft.entityframeworkcore.tools/index.json 74ms
Restoring packages for c:\users\intui\documents\visual studio 2017\Projects\PicturesApp\PicturesApp\PicturesApp.csproj...
Install-Package : Package Microsoft.EntityFrameworkCore.Tools 2.0.1 is not compatible with uap10.0.10586 (UAP,Version=v10.0.10586). Package
Microsoft.EntityFrameworkCore.Tools 2.0.1 supports: netstandard2.0 (.NETStandard,Version=v2.0)
At line:1 char:2
+ Install-Package Microsoft.EntityFrameworkCore.Tools
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Same issue also occured with the previous version (2.0.0), but the next previous version (1.1.4) was installed successfully.
However, I found that the "DbContextOptionsBuilder" class used in the code "PictureAppContext" class does not recognize the method "UseSqlite":
Severity Code Description Project File Line Suppression State Error CS1061 'DbContextOptionsBuilder' does not contain a definition for 'UseSqlite' and no extension method 'UseSqlite' accepting a first argument of type "DbContextOptionsBuilder' could be found (are you missing a using directive or an assembly reference?) PicturesApp c:\users\intui\documents\visual studio 2017\Projects\PicturesApp\PicturesApp\PictureAppContext.cs 16 Active
Anyone knows how resolve this issue?
Thanks!
I ran into this same issue using dotnet sdk 2.1.1 which was supposed to have all basic dependencies wrapped in Microsoft.AspnetCore.App. All i needed to do was run dotnet add package Microsoft.EntityFrameworkCore.Sqlite in a terminal window in the project directory (The directory that contains the Program.cs, Startup.cs, and
.csproj files)
For .NET 5, I had to install the package Microsoft.EntityFrameworkCore.Sqlite.Core
Check the link
I solved the issue by uninstalling the Nuget package Microsoft Entity Framework Core and installing Entity.Framework.Core.Sqlite.Design. I don't know why it solved the issue but the error is gone, I'm happy and that's all that matters.
I added using Microsoft.EntityFrameworkCore; as suggested in the GitHub issue (https://github.com/dotnet/AspNetCore.Docs/issues/7486#issuecomment-403117359)
Why can't I install Newtonsoft.Json in a .NET 4.0 project considering its dependencies?
I have a .NET class library project targetting .NET 4.0 that references the Newtonsoft.Json 4.5.6 NuGet package. I want to upgrade Newtonsoft.Json to the latest version (v10.0.3). This fails with the following message printed out on the Package Manager Console:
Could not install package 'System.Net.Http 4.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
The dependency behavior on install was: "Lowest".
Looking at the dependencies of Newtonsoft.Json NuGet package shows:
.NETFramework,Version=v4.0
No dependencies
Am I misinterpreting something? I expected that it can be installed in a .NET 4.0 project.
The full install log is:
Attempting to gather dependency information for package 'Newtonsoft.Json.10.0.3' with respect to project 'XYZ', targeting '.NETFramework,Version=v4.0'
Attempting to resolve dependencies for package 'Newtonsoft.Json.10.0.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Newtonsoft.Json.10.0.3'
Resolved actions to install package 'Newtonsoft.Json.10.0.3'
Removed package 'Newtonsoft.Json.4.5.6' from 'packages.config'
Successfully uninstalled 'Newtonsoft.Json.4.5.6' from XYZ Removed package 'System.Net.Http.2.0.20710' from 'packages.config'
Successfully uninstalled 'System.Net.Http.2.0.20710' from XYZ
Adding package 'Newtonsoft.Json.10.0.3' to folder 'c:\MAIN\packages'
Added package 'Newtonsoft.Json.10.0.3' to folder 'c:\MAIN\packages'
Added package 'Newtonsoft.Json.10.0.3' to 'packages.config'
Executing script file 'c:\MAIN\packages\Newtonsoft.Json.10.0.3\tools\install.ps1'...
Successfully installed 'Newtonsoft.Json 10.0.3' to XYZ Install failed.
Rolling back...
Package 'System.Net.Http.4.0.0' does not exist in project 'XYZ'
Removed package 'Newtonsoft.Json.10.0.3' from 'packages.config'
Adding package 'System.Net.Http.2.0.20710', which only has dependencies, to project 'XYZ'.
Package 'System.Net.Http.2.0.20710' already exists in folder 'c:\MAIN\packages'
Added package 'System.Net.Http.2.0.20710' to 'packages.config'
Package 'Newtonsoft.Json.4.5.6' already exists in folder 'c:\MAIN\packages'
Added package 'Newtonsoft.Json.4.5.6' to 'packages.config'
Removing package 'Newtonsoft.Json.10.0.3' from folder 'c:\MAIN\packages'
Removed package 'Newtonsoft.Json.10.0.3' from folder 'c:\MAIN\packages'
Could not install package 'System.Net.Http 4.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
========== Finished ==========
The only way to install Newtonsoft.Json into the .NET 4.0 project was to use dependency behavior "Ignore Dependencies".
Try to run in Packager manager console
Install-Package Newtonsoft.Json -Version 4.0.8
I'm running into an issue where I cannot install NuGet packages, or update packages, even though I have been able to install those packages in the past.
With a clean solution, I can create an ASP.NET MVC project using .NETFramework 4.5.2 (I've also tried with 4.6.1).
Since I take the default authentication options (Individual User Accounts), the Microsoft Owin packages are all scaffolded in, including the core Owin package (which is a dependency of the Microsoft Owin packages).
If I add another project (I started with a basic Class Library, but for testing purposes also tried a MVC project without authentication), I cannot add any Owin-related packages, as the Owin 1.0.0 package fails:
PM> Install-Package Owin
Attempting to gather dependencies information for package 'Owin.1.0.0' with respect to project 'Core', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Owin.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Owin.1.0.0'
Resolved actions to install package 'Owin.1.0.0'
Install failed. Rolling back...
Package 'Owin.1.0.0 : ' does not exist in project 'Core'
Install-Package : Could not install package 'Owin 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly referen ces or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:16
+ Install-Package <<<< Owin
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand PM>
The scaffolded project is using .NetFramework 4.5.2, and already has Owin version 1.0.0 working without a problem.
Similarly, Respond is included by default. The default version is 1.2.0.
I can use NuGet Package Manager to upgrade to version 1.4.1 without a problem. But if I try to upgrade to the latest stable, 1.4.2., I get the exact same errors as I do for the Owin install.
A coworker has a copy of the same project via source control, and he is also running VS2015. He can update to Respond 1.4.2. without a problem.
Another coworker duplicated every test I tried without running into any issues.
Even odder, I was able to add Owin and its dependencies to a .NET Class Library project this morning (but I couldn't upgrade to the newest Respond release). But after deleting the solution, and starting a new one, I started encountering my problems with a variety of packages.
I believe I found the solution.
I tried flushing my user cache and even uninstalling and reinstalling Visual Studio (deleting any AppData files that seemed related), but the problem persisted.
However, clearing the data in C:\Users\<<UserName>>\.nuget\packages has resolved the issue.
I'm trying to install MVC 6 beta in a regular .NET 4.5.2 web project (not DNX). It gives me an error. Is this possible? Or will it eventually be supported?
PM> install-package Microsoft.AspNet.Mvc -pre
Attempting to gather dependencies information for package 'Microsoft.AspNet.Mvc.6.0.0-beta5' with respect to project '6 - Entry Points\Sample.Web', targeting '.NETFramework,Version=v4.5.1'
Attempting to resolve dependencies for package 'Microsoft.AspNet.Mvc.6.0.0-beta5' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Microsoft.AspNet.Mvc.6.0.0-beta5'
Resolved actions to install package 'Microsoft.AspNet.Mvc.6.0.0-beta5'
Install failed. Rolling back...
Package 'Microsoft.AspNet.Mvc 6.0.0-beta5' does not exist in project 'Sample.Web'
Package 'Microsoft.AspNet.Mvc 6.0.0-beta5' does not exist in folder 'C:\Dev\Sample\packages'
Install-Package : Could not install package 'Microsoft.AspNet.Mvc 6.0.0-beta5'. You are trying to install this
package into a project that targets '.NETFramework,Version=v4.5.1', but the package does not contain any assembly
references or content files that are compatible with that framework. For more information, contact the package
author.At line:1 char:1
+ install-package Microsoft.AspNet.Mvc -pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackage
Command
No, you can't. And no, it won't be eventually supported.