Using Package Manage Console in Visual Studio, when I run "Add-Migration MyMigrationName" on Company.Project1 (.NET Core 1.1) I get an error
Could not find assembly 'C:\path\to\my\solution\Company.Project2\.\bin\Debug\netcoreapp1.1\Company.Project1.dll'.
The project you are running migrations on must be the startup project.
Related
I have a problem with my visual studio solution. Project is working but I got this error when I want to add migration. I could add migration before and downloaded the packages I need.
add-migration birim add-migration : The term 'add-migration' is not recognized as the name of a cmdlet, function, script file, or operable program.
I tried:
dotnet add EmployeeData package Microsoft.AspNetCore.Authentication.MicrosoftAccount
I got this error:
unable to create dependency graph file for project
So I added the package manually via "manage nuget packages for solution"
And now I have this error for my solution:
The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference for Microsoft.AspNetCore.App should be used instead. This will be added implicitly by Microsoft.NET.Sdk.Web.
And I got
Build failed.
when I tried to add migration.
I am almost sure this is about paths of projects and solutions.How can I solve this?
I just deleted the package Microsoft.AspNetCore.All and it's working.
I created a .NET Full Framework class library using EF Core v 2.2.1 and downloaded the EF Core driver v 2.x for Linqpad 5 (5.36.03), and when I try to create a new connection to the class library DLL, I get the following error message:
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependenceis. The system cannot find the file specified.
I have clicked the 'Restore nuGet Dependencies' and it gives me the message 'No NuGet dependencies detected'.
Any thoughts?
Did exactly what #magicandre1981 suggested and targted 4.7.2 for my class library. That fixed it!
I am writing a simple console application to test some EF Core code.
I added the entityframework.commands package.
install-package entityframework.commands -pre
The connection string is correct and tested, but when I execute
Update-Database
from the package manager I get the following error.
No DbContext was found. Ensure that you're using the correct assembly and that the type is neither abstract nor generic.
Of course, I have a context, just one in the project.
entityframework.commands is ancient. Use Microsoft.EntityFrameworkCore.Tools instead.
I am getting an error running Entity Framework migrations after updating to Visual Studio 2013.
PM> update-database
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Anybody know how to get around this?
I was able to fix this using the Microsoft Visual Studio 2012 Shell (Isolated) Redistributable Package. After I installed the package update-database worked correctly.
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
No pending code-based migrations.
Running Seed method.
Update from EF 5 to EF >6, it works!
It's a known issue in EF 5 that is corrected in EF 6.
More details can be found here and here.
I am having some trouble enabling code first migration following the Microsoft Data Developer procedure at http://msdn.microsoft.com/en-us/data/jj591621.aspx
I am using Visual Studio 2010 and targeting .NET Framework 4.0
I can run the following steps without error:
Create a new MigrationsDemo Console application
Add the latest version of the EntityFramework NuGet package to the project.
Tools –> Library Package Manager –> Package Manager Console
Run the Install-Package EntityFramework command (This installs Entity Framework 5)
However I receive an error when attempting to run the "Enable-Migrations" command in Package Manager Console:
Type is not resolved for member 'System.Data.Entity.Migrations.Design.ToolingFacade+GetContextTypeRunner,EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
I would greatly appreciate any suggestions on what I can do to resolve this issue.
FYI I hit this problem as well with VS 2012 and .NET framework 4.0 what helped me was this answer https://stackoverflow.com/a/13572319/2259509 , its ridiculous but the ampersand does seem to cause this error
<Private>True</Private>
For me, the above was missing from the assembly reference in the csproj file.
This means on build it isn't copied, and so cannot be seen.
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<HintPath>..\packages\Oracle.ManagedDataAccess.12.2.1100\lib\net40\Oracle.ManagedDataAccess.dll</HintPath>
<Private>True</Private>
</Reference>