I'm working on a project with Entity Framework in Webmatrix 2 RC, so I need to use Entity Framework v.5 RC because of conflicts between previous versions and .NET Framework 4.5.
The two ways I know to install NuGet packages in Webmatrix are from the NuGet Gallery on the Webmatrix ribbon and from the package manager in ASP.NET Web Pages Administration: either solution proposes only Entity Framework v4.3.1.
I have downloaded Entity Framework v.5 RC with the Package Manager Console of Visual Web Developer and copied the EntityFramework.dll into the bin folder of my project.
This solution works but I wonder if exists a way to install a not recommended NuGet package that doesn't require the use of Visual Web Developer.
You can use nuget.exe or NuGet Package Explorer, both are standalone and lightweight. You'll still have to manually add references to the files though.
Related
I'm having issues when creating an API Controller in .NET 5.0 with Entity Framework Core.
Here's what I'm doing:
I'm using .NET 5.0
Installed the Entity Framework Core packages and all 3 have the version 5.0
The model and DataContext classes have already been created and using them had already created a table in the database earlier
However when I right-click on the API project, click on Controller > Select "API Controller with actions, using Entity Framework" > Select "Model Class" & "DataContext class" > Enter the name of the controller
I keep getting the error
There was an error running the selected code generator: Package restore failed. Rolling back the changes for API
Troubleshooting done:
Cleared the NuGet Cache in Tools > Options > NuGet Package Manager > Clear All NuGet Cache(s)
Made sure that the Entity Framework Core packages and the .net version are the same in the .csproj
What am I missing here that is causing the issue?
If you have installed the latest version of Microsoft.VisualStudio.Web.CodeGeneration.Design package, you probably got version 5.0.2. That package cannot generate code based on Entity Framework Core packages of version 5.0.0.
From my experience - to generate EF Core based code, the version of your Design package should be equal to or less than the version of your EF Core packages. So, you need to either upgrade the EF Core packages, or install the version 5.0.0 of the Design package.
EDIT:
I faced the same issue and it was resolved after upgrading the EF Core packages, which is 5.0.4 currently, and installing the latest Design package, which is 5.0.2 currently.
In my case to generate EF core based code, i need to installed version 5.0.13 of Microsoft.EntityFrameworkCore and version 5.0.12 of Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityFrameworkCore.Tools
and version 5.0.2 of Microsoft.VisualStudio.Web.CodeGeneration.Design
Note:- Make sure to clear Nuget Cache
For one of my projects i am using asp.net mvc core and in this web application, for using EntityFramework i am not able to download 'Microsoft.Data.Entity' from nuget.
you have to install 2 package using the package manager
Microsoft.EntityFrameworkCore.SqlServer
Then in your code, require it:
using Microsoft.EntityFrameworkCore;
The package you need for EF Core is:
Microsoft.EntityFrameworkCore.SqlServer
It was due to ASP.Net Core framework was not installed correctly, i tried it in Visual Studio 2017 and guess what it worked perfectly.
I have created a nuget package implementing TinyEncryptionAlgorithm but it supports only .Net 4.6.1
Now I want to use this nuget into a .net core application NETStandard.Library and I don't know what I have to do.
Do I have to implement a completely new nuget package or I can include both assemplies in the same nuget package?
I have tried to create a NetStandard library and reference it from a .Net 4.6.1 but this is not working.
To support multiple version of .Net you must create portable libs.
Here is a tutorial of how to publish nuget for portable libs.
https://docs.nuget.org/ndocs/guides/create-net-standard-packages-vs2015
I am currently developing a portable library in C# that I want to publish on the NuGet official feed. I have published assemblies as NuGet packages before, but they were written against a single framework (.NET 4.0).
Now I'm confused how I should organize my lib folder in my NuGet package - my portable library can be used with .NET 4.5, ASP.NET Core 5.0, Windows 8, Windows Phone 8.1 and Windows Phone Silverlight 8 projects.
I tried to look up the framework profiles and their corresponding NuGet abbreviations, but I couldn't find them in the official documentation. Stephen Cleary gathered up profiles a while ago, but his list does not contain the profile for ASP.NET Core 5.0.
My actual question is: how should I structure the lib folder of my NuGet package? What is the profile name for portable libraries that target the framework versions mentioned above? And if I get that very profile name, is the assembly properly referenced in a non-portable library project (e.g. .NET 4.5 or WinRT)? Or should I make subfolders for the different framework version and copy the exact same assembly in all of them (which would largely increase the size of the package)? I habe seen some packages (like xunit.assert) doing it this way in NuGet Package Explorer.
The actual folder name that one has to use in this case is the following one:
portable-net45+wp80+win8+wpa81+dnxcore50
I recently did a portion of the MVCMusicStore tutorial using MVC3 as directed. However, being that I have Visual Studio 2012, I'm attempting to use EF in an MVC4 application. I was attempting to add the using System.Data.Entity; directive and it was not found.
I know that I can probably just add the reference to it. But I'd like to know why it's not already available for my MVC4 project. Is there a new method of creating an Entity Framework supported application using MVC4?
Entity Framework is now being distributed separately from Visual Studio through the NuGet package management system as of Visual Studio 2012. The reason for this is to decouple EF from the release of VS, so it can be released on a different time schedule. They have also recently released EF as an open source framework, so it's being removed as a project from the .net framework release.
You have to use NuGet to install Entity Framework in your project. Right click on the project and choose Manage Nuget Packages. Make sure you select the Online tab in the dialog that opens, then in the search type Entity Framework and click Install. You will then be able to add the using statement.