The nuguet package for EntityFramework (6.1.3) installs some tools that you can execute from the nuget package manager console (like AddMigration, Update-Database, etc.). Those are available if you use nuget and the appropiate .ps files are loaded.
I'am resolving my project & solution dependencies with paket instead of nuget, so those commands are not available to me.
Are there any alternative to execute those scripts without having to go back to nuget?
As #ErikEJ mentioned, you can use migrate.exe from the command line. Unfortunately (from the docs):
All the utility is designed to do is execute migrations. It cannot generate migrations or create a SQL script.
So you can run any existing migrations, but you can't create any new ones with this tool. That makes migrate.exe a pretty poor replacement for the tools EF provides in the Package Manager Explorer.
I tried manually importing the EntityFramework.psd1 file in the Package Manager Console:
PM> Import-Module ".\packages\EntityFramework\tools\EntityFramework.psd1"
While this made the Enable-Migrations command available, running it produced the following error:
No packages installed.
The EntityFramework package is not installed on project 'Foo'.
I'm guessing that this is all going to work better with EF7. But for now, it looks like I'll either have to ditch paket altogether, or have a frankenstein of both Paket and Nuget to get this working.
Yes, you an run migrate.exe from the command line, it is included in the NuGet package in the Tools folder.
https://msdn.microsoft.com/en-us/data/jj618307.aspx
From the Paket issue Entity Framework code-first migrations:
The EF commands wouldn't appear in the VS console until I've added version_in_path: true in paket.dependencies:
nuget EntityFramework ~> 6.2 version_in_path: true
Related
I tried to use EFCore with SQLite in a Xamarin.Android project. I also added the package Microsoft.EntityFrameworkCore.Tools. When I try to create database migrations I get various errors.
When running dotnet ef migrations add migrationname on the command line I get the error
No executable found matching command "dotnet-ef"
When running Add-Migration migrationname in Package Manager Console I get error
Startup project 'MyProject' targets framework 'MonoAndroid'. The Entity Framework Core Package Manager Console Tools don't support this framework.
Is there some way around this? Do I have to use EF6 instead of
The guidance for unsupported frameworks is to move your DbContext code into a .NET Standard class library and use a dummy .NET Core console app with the tools.
cd MyDbContextProject
dotnet ef migrations add MyMigration --startup-project ..\MyDummyProject
Im trying to use an ASP.NET web application downloaded from the internet. Im looking for a way restore all the dependencies/packages in a quick way (clean and building the project did not solve it), rather than installing them via nuget one by one. Is there anyway to download and install/resolve (version issues) all the necessary packages at once?
I tried below package manager console commands, but they did not resolve the package conflicts.
Update-Package -Reinstall,
nuget install packages.config and other solutions here - How do I get NuGet to install/update all the packages in the packages.config?
[resolve/install packages]
Can someone help? Maybe Im using wrong commands or doing something wrong.
If you go into Tools > Nuget Package Manager > Manage Nuget Packages for Solution, it will show a yellow bar at the top asking you if you want to restore missing packages. That's a manual way, but there are also some important VS options you want to look at as well, one being an option to restore packages on build.
There is a generic restore option as well from the package manager console, and that should have worked if it was simply a matter of reimporting the missing packages...
Update-Package -reinstall
You can try to delete the folders, than reinstall using these options. However, is there a possibility there is a .NET framework version mismatch with the version of the DLL's? Maybe some of the DLL's need updated?
Remove package folders from Package folder - don't remove package.config. Next, build you application - nuget should automatically restore all packages.
I got a asp.net mvc project from my friend. This is her project but i need to work on it. So when i try to start it, there are some errors. Here is that errors;
Could not copy the file "_bin_deployableAssemblies\x86\sqlceme40.dll" because it was not found.
Could not copy the file "_bin_deployableAssemblies\x86\sqlcecompact40.dll" because it was not found.
Could not copy the file "_bin_deployableAssemblies\x86\sqlceer40EN.dll" because it was not found.
Could not copy the file "_bin_deployableAssemblies\x86\sqlceca40.dll" because it was not found.
Could not copy the file "_bin_deployableAssemblies\x86\sqlcese40.dll" because it was not found.
Could not copy the file "_bin_deployableAssemblies\x86\sqlceqp40.dll" because it was not found.
I did some search and found some solutions about updating my nuget packages. I did all updates including EntityFramework.SQLServerCompact. But i have still that errors and have no idea what to do. So can someone could help me?
Thanks in advance.
I ran into the same issue after updating VS to 153.
However since I am not Using SqlServerCompact edition anywhere in my project: I use Entity Framework to SQL Server proper I didn't feel the need to have those references and provider in the web.config.
In the Web Project - I used NUGET to remove all references to SQLServer Compact Edition. Then I Removed the reference to SqlCEProvider in the providers section of the web.config. Recompiled and everything works as expected.
You can try this command:
Update-package -Reinstall
from Console administrator packages (PM)
I solved this error using the following steps (order of some steps matters):
Installed SQL Server CE 4.0. I had to install the x64 version to match my OS, but it included the x86 redistributable files referenced in my project.
Using NuGet, removed EntityFramework.SqlServerCompact from my project
Using NuGet, removed Microsoft.SqlServer.Compact from my project
Using NuGet, installed EntityFramework.SqlServerCompact, which also installed Microsoft.SqlServer.Compact.
I had the same issue and i uninstalled SQLServer Compact Edition and installed again from nuget packages
I created a new Project in Visual Studio 2013, a WebApi & MVC 5 project and updated all nuget packages. It updated to mvc 5.1. Now I cannot Successfully build the project it says
assembly uses System.Web.Http 5.1.0.0 which has a higher version than referenced assembly System.Web.Http 5.0.0.0
Anyone run into this before? Why these kind of problems do occur so often in Visual Studio? Does anybody know how to solve this because I really am trying hard but no luck so far...
Solved
I opened the Package Manager Console in Visual Studio and run the command
PM> Update-package
It magically resolved everything for me. You can find Package Manager Console under
Tools
Nuget Package Manager
Package Manager Console
This command deletes all the old packages under the package folder and updates everything if necessary, you may also run the command on a specific package. Here all the variants of the command http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference#Update-Package
Let me know if you found this useful I'm curious to know if it just happened to me accidentally
A new version of ASP.NET was released. Announcement here : http://blogs.msdn.com/b/webdev/archive/2014/01/20/announcing-the-release-of-asp-net-mvc-5-1-asp-net-web-api-2-1-and-asp-net-web-pages-3-1.aspx
You probably have two projects in your solution, where project A references project B. Both projects reference ASP.NET, but there is a version mismatch.
I had a very similar problem to yours exactly with a reference to System.Web.Http and have documented it here:
Could not load assembly error
When you update a Nuget package it would update dependent packages. But it would not update other packages in your solution that depend on the updated packages. These other packages might not even have a newer version built with the udpated packages.
So the solution is either to udpate all your packages like you did (this might not always work) or add binding redirects to the latest version of your assembly reference to your application config.
I solved this way. As I currently have fwk 4.0.0.0 and don't want to install 5.X:
I removed the referenced DLLs
I removed a couple of bindingRedirects at packages.config,
Then I rebuilded that solution, that throws me errors
Then I added the reference again
And voilà, the solution is running with the fwk that I have.
I am using EF 4.0, at the time I am writing these lines I heard that EF 4.1 update 1 has been released and EF 4.2 is in beta. From wikipedia
A refresh of version 4.1 named Entity Framework 4.1 Update 1, was
released on July 25, 2011. It includes bug fixes and new supported
types.
But I only found a link of Version 4.1.10311.0 from Microsoft which date published is 3/21/2011. So I wonder if version 4.1.10311.0 is the latest release so far. If it's not, where can I download the latest release ?
ps : For some reasons I can't use live update, I need to download package to install manually.
From Arthur Vickers:
What if I can’t use NuGet? What if you can’t connect to the Internet
from your development machine. Or what if you are not allowed to
install NuGet on your machine. Don’t worry; all is not lost.
First you need to get the NuGet package. For this you do need to be
able to connect to the Internet from some machine—but it doesn’t have
to be your development machine. You’re reading this so presumably
you’re not completely off-the-grid. :-)
You can get the package by using NuGet in Visual Studio on a machine
connected to the Internet in the normal way—just install the package
you want into a dummy project. After installing the package you can
find the .nupkg file either in the dummy project folder or by browsing
the Package Cache from the Package Manager Settings menu option.
You can also get the package without Visual Studio by using NuGet.exe.
If you are able to install NuGet on your development machine then do
so and setup a local feed. This may sound daunting but it’s really
easy. Copy the .nupkg file to your local feed and then use NuGet to
install it in the normal way—with no connection to the Internet
required.
If you can’t install NuGet on your development machine then take the
.nupkg file and rename it to .zip—yep, it’s a zip file. You can now
extract EntityFramework.dll from the zip file and use it as you would
any other assembly. Note that you will not get any of the automatic
project-level integration I mentioned above, so you may have to do
more manual configuration of your project.
If you are using EFv4.0 you mostly don't need EFv4.1 or EFv4.2. Those versions bring new type of mapping (code first / fluent) and new DbContext API which can be used instead of ObjectContext API. So unless you want to start a new project with those "new" features or completely migrate your existing project you don't need it. Real new functionality for you will be included in .NET 4.5. DbContext API and code first is shipped only as NuGet package since EFv4.2.
use the package-manager in VS2010 to install
Tools + Library Package Manager + Nuget package manager
EF 4.2 has just been released: http://blogs.msdn.com/b/adonet/archive/2011/11/01/ef-4-2-released.aspx
This is a minor update over 4.1.
The runtime components are available via NuGet. The designer etc. updates for VS are a separate install.