Enable-Migrations Not Working Because of the Windows on Mac

2

I am a Mac user but want to develop with C# via Visual Studio. Therefore, I have a Parallels account which is a programme for switching OS to the Windows while using it.

Firstly, let me introduce the error I am getting: (Trying to do it from the Package Manager Console inside of the NuGet Package Manager)

Cannot determine a valid start-up project. Using project 'CodeFirstNewDatabaseSample' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.

Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\Mac\Home\Desktop\Visual Studio 2015\Projects\CodeFirstNewDatabaseSample\packages\EntityFramework.6.1.3\tools\E ntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" At \Mac\Home\Desktop\Visual Studio 2015\Projects\CodeFirstNewDatabaseSample\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:62 + $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll)) + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

You cannot call a method on a null-valued expression. At \Mac\Home\Desktop\Visual Studio 2015\Projects\CodeFirstNewDatabaseSample\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:50 + $dispatcher = $utilityAssembly.CreateInstance <<<< ( + CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file://\Mac\Home\Desktop\Visual Studio 2015\Projects\CodeFirstNewDatabaseSample\packages\EntityFramework.6.1 .3\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)" At \Mac\Home\Desktop\Visual Studio 2015\Projects\CodeFirstNewDatabaseSample\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 char:31 + $domain.CreateInstanceFrom <<<< ( + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException

VS2015 is currently downloaded on my system. I have a model class and a local database but from now on I want to be able to change the database via the migrations. However, I'm having trouble with achieving it and I think the reason behind is the fact Windows is in on Mac as this question suggests. I thought in that way because when I wanted to access my Visual Studio Projects on Windows system, I entered into from the directory named Home on 'Mac'(Y:) under Network Location (The exact path I followed is Computer->Home on 'Mac'(Y:)[Under Network Location tab]->Documents->Visual Studio 2015). Again, as the answer in the question the suggests, I cut it and paste to the Desktop of my Windows system. But later I realized, I am only able to reach Desktop from Network Locations tab in the Computer directory.

I hope anyone had the same trouble before and solved so he can help me about it.

Waiting for your good answers,

Thanks,

c#
entity-framework
nuget-package
migrate
asked on Stack Overflow Feb 8, 2016 by Kutay Demireren • edited May 23, 2017 by Community

2 Answers

3

I have the same configuration (OSX + Parallels) and had the same problem than you. When source code is on OSX shared folder EF Package Manager Console throws that message. And as your link states, the problem is not Mac+Parallels but having the code on a network location.

If you move the code to your VM's desktop, maybe it's still network location if Paralells is configured to share desktop between Mac and Windows. Just try some pure windows location, as C:\VsProjects

I ended up moving the code to Windows location, it worked much better for me, but if you want to keep the code on network folder just need to use -StartupProjectName and specify the executable project there explicitly.

answered on Stack Overflow Feb 8, 2016 by tede24
0

For me the issue was that the DataAccessLayer project was not being identified. I had to specifically specify the -ProjectName and then the migration worked.

Enable-Migrations -ProjectName <Project>.DataAccessLayer -StartUpProjectName <Project>.WebApi -Verbose
answered on Stack Overflow Jun 22, 2018 by footyapps27

User contributions licensed under CC BY-SA 3.0