Update MVC from 4.0 to 5.2 - Could not install package - asp.net

I'm trying to update my project from MVC 4.0 to 5.2. But As soon I do that I get an error message:
Install-Package : Could not install package 'Microsoft.AspNet.Razor 3.2.3'. You are trying to install this packag
e into a project that targets '.NETFramework,Version=v4.0', 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:1
+ Install-Package Microsoft.AspNet.Mvc -Version 5.2.3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
How can I Solve this issue? And What does this mean?

Related

Why can't I install Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.1 via nuget? Asp.NET CORE 2.0.1

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

ASP .NET MVC 6 Without DNX

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.

How do I install ServiceStack.Interfaces?

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.

Elasticsearch.Net Nuget Packagage

I am having an issue with the Elasticsearch.Net Nuget package.
I am not very familiar with the .Net environment and more with development, and after i followed the quick start for Nest (http://nest.azurewebsites.net/elasticsearch-net/quick-start.html) i cannot install the Elasticsearch.Net package but the Nest Nuget is installed.
The error i am getting is:
Install-Package : Unable to find package 'Elasticsearch.Net'.
At line:1 char:16
+ Install-Package <<<< Elasticsearch.Net
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId :NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Even though the documentation has been updated, the initial release of the Elasticsearch.Net 1.0 client has not been published on NuGet yet. NEST is available on NuGet as you found, but is still at version 0.12.0. Version 1.0 of Elasticsearch.Net and NEST should be released shortly. In the meantime, you can continue to use NEST 0.12.0. The 1.0 documentation is still pretty accurate for most of the basic operations and querying. Alternately, you could get the latest source for Elasticsearch.Net and NEST from the Elasticsearch.Net GitHub site, compile it locally and manually reference it your project.

Error installating MVVM Light libraries only (PCL)

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.

Resources