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.
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 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
I'm a newbie and creating an ASP.Net empty web application (C#) project. But I got this error when installing nuget package Microsoft.AspNet.Identity.Owin -Version 2.1.0.
I don't know what's seemed to be the problem bcoz I'm using the newer version VS 2012 .Net Framework 4.5 and not VS 2010.
Tried install and uninstalling nuget packages but to no avail.
Error result:
Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))
Uninstalling 'Microsoft.AspNet.Identity.Core 2.1.0'.
Successfully uninstalled 'Microsoft.AspNet.Identity.Core 2.1.0'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'Microsoft.AspNet.Identity.Core'.
At line:1 char:16
+ Install-Package <<<< Microsoft.AspNet.Identity.Owin -Version 2.1.0
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
What's seemed to be the problem?
N.B: For reasons unknown, I had the same problem with installing nuget Package EntityFramework Version 6.1.1 but managed to resolve it by adding package.config file to the project.
Many thanks indeed.
I'd the same problem as did you,I don't know what was wrong.I created a couple of projects to check it and nothing worked, I thought the issue was with my frame work as It targets only above 4.0 and VS 12 and above. But that wasn't the problem.
After some time I tried to install them again and out of the blue I don't know How they just got installed. I will suggest to restart the VS or system that might be helpful
Starting Visual Studio as Administrator in combination with using the Package Manager Console seems to help.
I believe that you have to change the package source in the Package Manager Console, then you can type your command. I faced the same problem, and I wondered why I can't install the package by typing the command.
I have tried installing the ServiceStack Framework on both .Net 4.0 and .Net 4.5 applications. I have gotten the same error both times:
Install failed. Rolling back...
Install-Package : Could not install package 'ServiceStack.Interfaces 4.0.31'. 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 that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Servicestack
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
and
Install failed. Rolling back...
Install-Package : Could not install package 'ServiceStack.Interfaces 4.0.31'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any
assembly references that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Servicestack
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
What gives?
The major change to happen to ServiceStack.Interfaces is that it's now a portable library as of v4.0.30 supporting most supported platforms (Profile136):
.NET 4.0+
Xamarin.iOS
Xamarin.Android
Windows Store
Silverlight 5
If NuGet is reporting that it can't find the necessary assembly references for a supported platform than it's likely that you're using an older version of NuGet that doesn't include PCL support, which can be resolved by upgrading to the latest NuGet.
The "upgrade Nuget" option was not working for me. Turns out that versions of ServiceStack do have .NET limits. Our application is .NET 4.0, so ServiceStack.Interfaces 4.062 was the highest version we could install.
I create a new PCL project, select Store app + Phone 8 + .Net 4.5
Then, from pakage manager console, I do:
Install-Package Portable.MvvmLightLibs -Pre
but it is not installed, I get an error. What I am doing wrong?
Thank you
The error message is:
Install-Package : Could not install package 'Portable.MvvmLightLibs 4.1.24-beta3'. You are trying to install this package into a project that
targets '.NETPortable,Version=v4.5,Profile=Profile78', but the package does not contain any assembly references that are compatible with that
framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Portable.MvvmLightLibs -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I had the same problem, but upgrading NuGet (currently 2.2) seems to have done the trick.