Closed vsfeedback closed 1 year ago
What is the output of running this in Package Manager Console?
(Get-Project 'TestEf2').ConfigurationManager.ActiveConfiguration.Properties.Item('OutputPath').Value
I have the latest one Version 16.1.5 and still I am getting the same error.
running Get-Project 'Project_Name').ConfigurationManager.ActiveConfiguration.Properties.Item('OutputPath').Value, throwing error from Package Manager console. You cannot call a method on a null-valued expression. At line:1 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Finally figured-out issue and fixed it.
It's 'Azure development' component which is causing this error (desp.json) , Un-installing that component is fixed this issue. Now, I can execute every EF core command successfully from package manager console. Hope! it will be fixed in future update.
I am using Visual studio 2019 community edition - 16.1.5
What is the "Azure Development," component?
Can you send us a simple repro so we can help get it fixed?
Azure development option available during visual studio installation.I un-installed it and efcore issue resolved
To repro,:
For any existing aspnetcore project, run command update-database and you will get same error.
Environment details: Aspnetcore 2.2 Visual studio 2019 community edition 16.1.5 Efcore Windows 10 64 bit machine
I am having similar issue with my newly installed Visual Studio Professional 2019 16.1.6 (alongside VS Professional 2017) on Windows 10 machine. I created a sample ASP.NET Core 2.1 Web Application (MVC). The solution builds successfully. However, when I try running "Add-Migration InitialCreate" command in Package Manager Console. I'm getting the error "The specified deps.json ... does not exist".
I tried creating identical project using Visual Studio Professional 2017 on the same machine and I was able run migration commands without error.
I searched online for solutions and tried a number of suggestions including copying bin\debug folder to bin\MCD\debug and uninstalling azure related components but nothing seems to work.
UPDATE: I cloned the project to another machine with single but just a bit older installation of Visual Studio (VS Professional 2019 16.0.4) and the migration commands runs without error. So it's either the new version 16.1.6 or installing VS 2019 alongside 2017 which is causing the error?
@corix010 Can you post your project/solution here so we can investigate?
@ajcvickers I am certain there's no problem with the sample projects. Please see update in my previous comment.
Same issue with ASP.NET Core 2.2 and the latest VS 2019 update. On my other laptop everything runs fine. It doesn't work on my HP Omen. I read about HP and MCD but it doesn't seem to help or I'm doing something wrong. I will do more research.
Same issue here. I am just adding a view from the controller (right click Add View select Empty template). Uninstalling Azure Development as suggested above did not resolve the issue.
I cleaned and rebuild the solution and checked the \bin\Debug\netcoreapp2.2\ folder and it's empty.
So, that's where the issue lies. The error happens because it's looking for that "deps.json" file which was not found due to build errors.
I have to resolve the build errors first to add a view.
Adding static views should not be dependent on that one particular file right???
Visual Studio Professional 2019 version 16.2.3 Project: Asp.Net Core MVC (.Net Core 2.2)
See attached.
I have the same version of Visual Studio and .NET Core as @joelrb
I am encountering the same exact error when adding controller or basically any creation of a new item in the solution when using a template.
The screenshot attached in the post by @joelrb above is identical to what I would provide.
Any ideas for me to try?
I'm not able to repro this on 16.3 Preview 4. Hopefully that means it's fixed. Let me try on 16.2.5 just to confirm.
Hmm, 16.2.5 didn't repro either... Maybe it was fixed in 16.2 and the scaffolding issue is different. (possibly https://github.com/aspnet/Scaffolding/issues/522)
I am using VS 2019 16.2.5. I have attempted to follow the razor pages tutorial and the MVC tutorials multiple times. Each time I run the command add-Migration Initial I get the following error.
The specified deps.json [C:\Users\John\Documents\My Web Sites\RazorPagesMovie2\RazorPagesMovie\RazorPagesMovie.deps.json] does not exist
Willing to try any suggestions you may have. Thanks.
Do you have any build errors? You need to fix those before scaffolding
Also, if you can send me a repro project, I’d be happy to investigate more
Thank you for the reply. I have no build errors. Will have the repro project to you shortly.
Repro attached. Looking forward to your thoughts. RazorMovieApp_Tutorial.zip
I had same issues. The location of deps.json was pointing to different folder than the project folder. So I inspected my environment variables, and found that I had variable ProjectDir pointing to specific folder. The problem went away after I deleted the ProjectDir enviroment variable.
Where is the ProjectDir variable located? Would like to replicate deleting ProjectDir environment variable to see if it resolved my issues.
ProjectDir was under Windows Environment Variables for User. I don't remember adding it, but deps.json was pointing to bin directory under directory mentioned in ProjectDir.
It still remains on .NET Core 3.0.
@JohnnyB77 I'm not able to repro the issue with your project on my machine. What is the result of running the following command inside PMC?
(Get-Project RazorPagesMovie).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value
@Hulkstance Do you have a project I can try?
bricelam, I cut and pasted the command you provided and got the following result on the PMC.
PM> (Get-Project RazorPagesMovie).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value You cannot call a method on a null-valued expression. At line:1 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Anything else that I could try?
Which part is null? (Get-Project RazorPagesMovie).ConfigurationManager.ActiveConfiguration
? I've seen a few people reporting this, it could be an issue in dotnet/project-system
I have tested
Repro attached. Looking forward to your thoughts. RazorMovieApp_Tutorial.zip
I have tested it with Visual studio Community 2019 Version 16.3.1 and there is no such issue with add-migration or update-database. it's working fine.
I have run this command: (Get-Project RazorPagesMovie).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value
Output is: bin\Debug\netcoreapp2.2\
I'm using 16.3.1 and having the same problem @joelrb mentioned. If the project has build errors, I cannot add a page. I receive the same error as in his screenshot.
I have a project that does not run into this error. However, when moving my project to a different location on my computer I encounter this same error. If I open the original project (in the original location) I don't get this error. It seems very strange to me.
i have the same problem i m using de last version vs 2019 PM> Add-Migration initial -v Using project 'ApiRentMe'. Using startup project 'ApiRentMe'. Build started... Build succeeded. C:\Program Files\dotnet\dotnet.exe exec --depsfile D:\GitHub\xxx-back\RentMeWebApi\xxxx.deps.json --additionalprobingpath "C:\Users\Diego Suarez.nuget\packages" --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" "C:\Users\Diego Suarez.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll" migrations add initial --json --verbose --no-color --prefix-output --assembly D:\GitHub\xxxx-back\xxxxx\xxx.dll --startup-assembly D:\GitHub\xxxx-back\xxxxxi\xxxx.dll --project-dir D:\GitHub\xxxx-back\xxxxx\ --language C# --working-dir D:\GitHub\xxxx-back --root-namespace xxxx The specified deps.json [D:\GitHub\xxxx-back\xxxxi\xxxx.deps.json] does not exist
The same problem vs2019 16.3.3 Win10 19.03 add-migration init -v Using project 'DWL.Web'. Using startup project 'DWL.Web'. Build started... Build succeeded. C:\Program Files\dotnet\dotnet.exe exec --depsfile D:\VS2019\DWL\DWL\DWL.Web\DWL.Web.deps.json --additionalprobingpath C:\Users\admin.nuget\packages --additionalprobingpath C:\Microsoft\Xamarin\NuGet C:\Users\admin.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add init --json --verbose --no-color --prefix-output --assembly D:\VS2019\DWL\DWL\DWL.Web\DWL.Web.dll --startup-assembly D:\VS2019\DWL\DWL\DWL.Web\DWL.Web.dll --project-dir D:\VS2019\DWL\DWL\DWL.Web\ --language C# --working-dir D:\VS2019\DWL\DWL --root-namespace DWL.Web The specified deps.json [D:\VS2019\DWL\DWL\DWL.Web\DWL.Web.deps.json] does not exist
Note from triage: we are not able to reproduce this. There must be something about the environment that is impacting this in a way that is not apparent. If someone has any ideas what this might be, then we can continue to investigate, but as of now we are out of ideas.
Things began working for me after I updated visual studios
For me: Package Manager try to find in D:\VS2019\DWL\DWL\DWL.Web\DWL.Web.deps.json But File in d:\VS2019\DWL\DWL\DWL.Web\bin\Debug\netcoreapp3.0\ Any idea how can I change path? p.s. Reinstall win10(1903) and vs2019(16.3.4) on my comp - the problem still exists.
smth with comp - replaced the computer the problem is gone
@StarikKsardas Can you share your project?
Same issue here, using VS P 16.3.5 in a VM with Parallel and tried with all your suggestions but i'm getting the same error. I don't know why when i make a restore i lose all my project references, apear with the yellow warning. can that mean something ?
Was able to reproduce, I think, when using IHostingEnvironment instead of Microsoft.AspNetCore.Hosting.IWebHostEnvironment
@ccr8 @adamdewolf Can you please post a project that reproduces what you are seeing?
@StarikKsardas https://github.com/aspnet/EntityFrameworkCore/issues/16386#issuecomment-535668335
Same issue here. VS 2019 V16.3.6 gives the error VS 2017 Works fine I have run this command: (Get-Project MyProject).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value Output : **You cannot call a method on a null-valued expression. At line:1 char:1
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull**
then I ran this command: (Get-Project Cupcakes).ConfigurationManager.ActiveConfiguration Output: DTE : System.ComObject Collection : System.ComObject ConfigurationName : Debug PlatformName : Any CPU Type : 1 Owner : Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject Properties : IsBuildable : True IsRunable : True IsDeployable : False Object : Microsoft.VisualStudio.ProjectSystem.VS.Properties.CSharp.CSharpProjectConfigurationProperties ExtenderNames : {} ExtenderCATID : {89FB23F7-E591-.......}
Notice the value of Properties is Null
Hope this helps to put you on the right track to solve this issue.
@davkean Any ideas what might be going on here?
@davidwengier This looks like the same issue we ran into with the CodeAnalysis telemetry where Properties was returning null. I don't think we even figured out the root cause for this. A repro project would be amazing.
Looks like the same root issue, yes, but from reading the comments it seems more machine based than project based. Certainly with the supplied RazorPagesMovie.zip from above, I don't repro the issue with or without the Azure workload installed, on 16.3.4.
This issue has been driving me nuts. Yes, it seems machine based. From my main workstation which has been installed from scratch one month ago and is a Windows 10 Enterprise Version 1903 with VS 2019 16.3.7 running (Get-Project ApiAuthSample).ConfigurationManager.ActiveConfiguration on a problem project I get DTE : System.ComObject Collection : System.ComObject ConfigurationName : Debug PlatformName : Any CPU Type : 1 Owner : Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject Properties : IsBuildable : True IsRunable : True IsDeployable : False Object : Microsoft.VisualStudio.ProjectSystem.VS.Properties.CSharp.CSharpProjectConfigurationProperties ExtenderNames : {} ExtenderCATID : {89FB23F7-E591-4a2f-8E0F-64C0522FCF77} OutputGroups : System.__ComObject
Blank Properties - I did a fresh install of the same VS on an identical OS on a VM and copied the project over, built the project and ran the same PMC command and got:
DTE : System.ComObject Collection : System.ComObject ConfigurationName : Debug PlatformName : Any CPU Type : 1 Owner : Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAProject Properties : System.ComObject IsBuildable : True IsRunable : True IsDeployable : False Object : Microsoft.VisualStudio.ProjectSystem.VS.Properties.CSharp.CSharpProjectConfigurationProperties ExtenderNames : {} ExtenderCATID : {89FB23F7-E591-4a2f-8E0F-64C0522FCF77} OutputGroups : System.ComObject
*Properties now exist. Further running the following command gets an expected result (Get-Project ApiAuthSample).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value bin\Debug\netcoreapp3.1\
If it has anything to do with the installed products I offer: On the VM I did a minimal install of VS, Here are the installed products On the main (failing) machine:
Microsoft Visual Studio Professional 2019 Version 16.3.7 VisualStudio.16.Release/16.3.7+29424.173 Microsoft .NET Framework Version 4.8.03752
Installed Version: Professional
ADL Tools Service Provider 1.0 This package contains services used by Data Lake tools
Application Insights Tools for Visual Studio Package 9.1.00913.1 Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2019 16.3.286.43615 ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2019 16.3.286.43615 For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.3.286.43615 Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.4.2000.0 Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 16.3.286.43615 Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.4.2000.0 Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure HDInsight Azure Node 2.4.2000.0 HDInsight Node under Azure Node
Microsoft Azure Hive Query Language Service 2.4.2000.0 Language service for Hive query
Microsoft Azure Stream Analytics Language Service 2.4.2000.0 Language service for Azure Stream Analytics
Microsoft Azure Stream Analytics Node 1.0 Azure Stream Analytics Node under Azure Node
Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.0.83+gbc8a4b23ec Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Mono Debugging for Visual Studio 16.3.7 (9d260c5) Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.5.10807.1 Commit Hash:4d3cf548113f5a53a02d83a877ee24e764b2cde4 Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 5.3.1 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Office Developer Tools for Visual Studio 16.0.29217.00 Microsoft Office Developer Tools for Visual Studio
ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info
SQL Server Data Tools 16.0.61908.27190 Microsoft SQL Server Data Tools
ToolWindowHostedEditor 1.0 Hosting json editor into a tool window
TypeScript Tools 16.0.10821.2002 TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823 Microsoft Visual F# Tools 10.4 for F# 4.6
Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers
VisualStudio.Mac 1.0 Mac Extension for Visual Studio
Workflow Manager Tools 1.0 1.0 This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 16.3.0.277 (d16-3@c0fcab7) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.3.0.246 (remotes/origin/d16-3@bd2f86892) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.3.565 (27e9746) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.0.3.0 (d16-3/4d45b41) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2019-06@5608fe0abb3 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333
Xamarin.iOS and Xamarin.Mac SDK 13.4.0.2 (e37549b) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Here are the installed products on the VM (successful) machine: Microsoft Visual Studio Professional 2019 Version 16.3.7 VisualStudio.16.Release/16.3.7+29424.173 Microsoft .NET Framework Version 4.8.03752
Installed Version: Professional
Application Insights Tools for Visual Studio Package 9.1.00913.1 Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2019 16.3.286.43615 ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2019 16.3.286.43615 For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.3.286.43615 Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 16.3.286.43615 Azure Functions and Web Jobs Tools
C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4 Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.0.83+gbc8a4b23ec Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1 Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
NuGet Package Manager 5.3.1 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info
SQL Server Data Tools 16.0.61908.27190 Microsoft SQL Server Data Tools
TypeScript Tools 16.0.10821.2002 TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823 Microsoft Visual F# Tools 10.4 for F# 4.6
Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0 Visual Studio Tools for Containers
Hope this helps - Let me know if I can offer any other environment information.
I have the same issue. VS Version 16.3.7 under Windows 7, solution with .net core 3
Solution was migrated from .net core 2.2 to .net core 3
When trying to execute Add-Migration command it shows error:
The specified deps.json [E:\projects\XXX\src-dev\YYY\YYY.deps.json] does not exist
Path for deps.json is always the same: there is no difference what project is selected as default project in package manager console and it is no difference what output path is specified for project YYY.
Actually deps.json exists in directory where artifacts of the project YYY are located (YYY/bin/Debug/netcoreapp3.0/). If to copy it to the desired path as specified in error message, the following error appears:
Error:
An assembly specified in the application dependencies manifest (YYY.deps.json) was not found:
package: 'DevExtreme.Extensions', version: '1.0.0'
path: 'DevExtreme.Extensions.dll'
DevExtreme.Extensions is one of projects in my solution.
Then I tried to edit this stupid deps.json manually and add absolute path to all libraries it can't found. References to libraries look like this (we need to specify path for runtime section):
"DevExtreme.Extensions/1.0.0": {
"dependencies": {
"DevExtreme.AspNet.Core": "19.2.3",
"Newtonsoft.Json": "12.0.2"
},
"runtime": {
"e:/projects/XXX/src-dev/YYY/bin/Debug/netcoreapp3.0/DevExtreme.Extensions.dll": {}
},
"compile": {
"DevExtreme.Extensions.dll": {}
}
},
After that, the following error appears:
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Unfortunately, other manual manipulations with deps file didn't change anything.
I also tried to use -v with Add-Migration command. It shows command with wrong paths:
C:\Program Files\dotnet\dotnet.exe exec --depsfile E:\projects\XXX\src-dev\YYY\YYY.deps.json --additionalprobingpath C:\Users\Shiko\.nuget\packages --additionalprobingpath C:\Microsoft\Xamarin\NuGet --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" C:\Users\Shiko\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add DocTemplate --json --verbose --no-color --prefix-output --assembly E:\projects\XXX\src-dev\YYY\YYY.dll --startup-assembly E:\projects\XXX\src-dev\YYY\YYY.dll --project-dir E:\projects\XXX\src-dev\YYY\ --language C# --working-dir E:\projects\XXX\src-dev --root-namespace YYY
After fixing paths and running this command in console output shows error like shown above. If to keep --deps parameter, output is:
info: System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
info: File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
info: at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
info: at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
info: at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
info: at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
info: at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
info: at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
info: at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
error: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
If to remove --deps parameter, output is:
info: System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
info: File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
info: at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
info: at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
info: at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
info: at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
info: at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsAddCommand.Execute()
info: at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
info: at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
error: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Any recommendations found at stackoverflow or somewhere else are completely useless in my case.
I've made some additional experiments and it seems I've found a workaround.
If to roll back to .net core 2.2 and try to add migration in VS 2019, the same problem occurs. As follows from additional output, it uses EF Core 3 to execute Add-Migration command. If switch to VS 2017, everything is ok.
I tried to investigate command line formed in VS 2017 and found that it contains parameter that was missed in VS 2019:
--runtimeconfig E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\YYY.runtimeconfig.json
But VS 2017 builds command line to launch EF Core 2.2.6.
I tried to insert this parameter into command line built by VS 2019 (with path to EF Core 3) and it worked as expected (exception was raised with message that no DbContext found in assembly YYY):
"C:\Program Files\dotnet\dotnet.exe" exec --depsfile E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\YYY.deps.json --additionalprobingpath C:\Users\Shiko\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\YYY.runtimeconfig.json C:\Users\Shiko\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add DocTemplate --json --verbose --prefix-output --assembly E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\YYY.dll --startup-assembly E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\YYY.dll --project-dir E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp2.2\ --language C# --working-dir E:\projects\XXX\src-dev --root-namespace YYY
Now I can build a command line that will do what I need:
"C:\Program Files\dotnet\dotnet.exe" exec --depsfile E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp3.0\YYY.deps.json --additionalprobingpath C:\Users\Shiko\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp3.0\YYY.runtimeconfig.json C:\Users\Shiko\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add DocTemplate --json --verbose --prefix-output --assembly E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp3.0\XXX.Dal.dll --startup-assembly E:\projects\XXX\src-dev\YYY\bin\Debug\netcoreapp3.0\YYY.dll --project-dir E:\projects\XXX\src-dev\Database\XXX.Dal\ --language C# --working-dir E:\projects\XXX\src-dev --root-namespace XXX.Dal
This command line adds expected migration.
It seems obvious the problem is in command-line generation. Scaffolding tool works well. I've read a lot of posts about the same issue under different versions of VS, therefore problem is located somewhere in command line generator.
P.S. Some notes on workaround "how-to". It could be useful to create cmd file with this command line. Migration name "DocTemplate" has to be replaced with %1 (reference to cmd parameter number 1). Then this cmd file could be added into "External tools" list in VS Tools menu. Check the "Prompt for arguments" option -- VS will prompt for arguments to be passed to cmd file before execution. We have only one argument -- name of migration to create. How to create a migration step-by-step:
Thank you for the in depth information on installed components @alwilton. Unfortunately after installing additional workloads on my machine I still can't reproduce this issue. Looking in Help -> About for me, I see no components that you have that I don't have. Sadly its possible for other components to be installed that don't show in Help -> About so its not an exhaustive list.
If you can, it would be great if you can reproduce the problem (run (Get-Project ApiAuthSample).ConfigurationManager.ActiveConfiguration.Properties.Item('OutputPath').Value
to see it error) and then use the Report a Problem system in Visual Studio as that will capture a memory dump that will hopefully allow me to see more of what is going on. If you can link to the report that is created here, I will be able to find it more easily.
Create new .net core MVC project, run it, stop debug, then write in Package Manager Console the string to add migration:
It was working before update of VS 2019. Now I have 16.1.3. Generated files are inside in G:\testef\TestEf2\bin\Debug\netcoreapp2.2 folder.
This issue has been moved from https://developercommunity.visualstudio.com/content/problem/610087/the-specified-depsjson-does-not-exist-after-vs-201.html VSTS ticketId: 923080 These are the original issue comments:
Visual Studio Feedback System on 6/18/2019, 02:59 AM (13 days ago): We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Visual Studio Feedback System on 6/18/2019, 11:06 PM (12 days ago): Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2017#faq . In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/ . We'll keep you posted on any updates to this feedback.
These are the original issue solutions:
xekegedud solved on 6/21/2019, 10:09 AM (10 days ago), 0 votes:
I have tried this at home (this is OP posting) on my home machine and it works on 16.1.2 and after I updated to 16,1,3 it works too. So I just need to fix this error on my work machine; the only problem I dont know how.
xekegedud solved on 6/27/2019, 00:39 AM (4 days ago), 0 votes:
updated to 16.1.4, still the same output: