You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be a regression of the issue originally reported in #9623, but I am unable to change my migration target from the PS session in Visual Studio (using the Package Manager Console PS session) for an ASP.NET Core project backed up by EF Core 2.1.
I tried setting the environment variable to the target environment I want, confirmed the variable is set, but as shown below, the migration still runs in the context of the default Development environment.
PM> $env:ASPNETCORE_ENVIRONMENT="Test"
PM> Get-ChildItem env:ASPNETCORE_ENVIRONMENT
Name Value
---- -----
ASPNETCORE_ENVIRONMENT Test
PM> Update-Database -Verbose
Using project 'DataApp'.
Using startup project 'DataApp'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile D:\code\data\src\Product\DataApp\bin\Debug\netcoreapp2.1\DataApp.deps.json --additionalprobingpath C:\Users\tudordid\.nuget\packages --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig D:\code\data\src\Product\DataApp\bin\Debug\netcoreapp2.1\DataApp.runtimeconfig.json C:\Users\tudordid\.nuget\packages\microsoft.entityframeworkcore.tools\2.1.4\tools\netcoreapp2.0\any\ef.dll database update --verbose --no-color --prefix-output --assembly D:\code\data\src\Product\DataApp\bin\Debug\netcoreapp2.1\DataApp.dll --startup-assembly D:\code\data\src\Product\DataApp\bin\Debug\netcoreapp2.1\DataApp.dll --project-dir D:\code\data\src\Product\DataApp\ --language C# --working-dir D:\code\data --root-namespace DataApp
Using assembly 'DataApp'.
Using startup assembly 'DataApp'.
Using application base 'D:\code\data\src\Product\DataApp\bin\Debug\netcoreapp2.1'.
Using working directory 'D:\code\data\src\Product\DataApp'.
Using root namespace 'DataApp'.
Using project directory 'D:\code\data\src\Product\DataApp\'.
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider...
Finding IWebHost accessor...
Using environment 'Development'.
Using application service provider from IWebHost accessor on 'Program'.
Checking up on my environment variable right after this failure shows that it is no longer assigned:
PM> Get-ChildItem env:ASPNETCORE_ENVIRONMENT
Get-ChildItem : Cannot find path 'ASPNETCORE_ENVIRONMENT' because it does not exist.
At line:1 char:1
+ Get-ChildItem env:ASPNETCORE_ENVIRONMENT
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ASPNETCORE_ENVIRONMENT:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
The original posted for issue #9623 eventually reported this working for him, but since that was more than a year ago, I wonder if this a regression in the tool.
I am able to make this work if I set the environment variable in a CMD / PS session before I run Visual Studio, and then start VS from the same session, basically having the variable already available in the package manager. However, trying to override it there to switch to a different environment renders the same behavior, in the sense that my override is ignored and it only runs against the initial environment I set before running VS.
Further technical details
EF Core version: 2.1.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.1
PS Version: 5.1.17763.134
The text was updated successfully, but these errors were encountered:
I'm not able to repro this. For me, environment variables are persisted in PMC and copied into child processes. You may want to follow up on NuGet/Home.
EF Team Triage: Closing this issue as the requested additional details have not been provided and we have been unable to reproduce it.
BTW this is a canned response and may have info or details that do not directly apply to this particular issue. While we'd like to spend the time to uniquely address every incoming issue, we get a lot traffic on the EF projects and that is not practical. To ensure we maximize the time we have to work on fixing bugs, implementing new features, etc. we use canned responses for common triage decisions.
This might be a regression of the issue originally reported in #9623, but I am unable to change my migration target from the PS session in Visual Studio (using the Package Manager Console PS session) for an ASP.NET Core project backed up by EF Core 2.1.
I tried setting the environment variable to the target environment I want, confirmed the variable is set, but as shown below, the migration still runs in the context of the default Development environment.
Checking up on my environment variable right after this failure shows that it is no longer assigned:
The original posted for issue #9623 eventually reported this working for him, but since that was more than a year ago, I wonder if this a regression in the tool.
I am able to make this work if I set the environment variable in a CMD / PS session before I run Visual Studio, and then start VS from the same session, basically having the variable already available in the package manager. However, trying to override it there to switch to a different environment renders the same behavior, in the sense that my override is ignored and it only runs against the initial environment I set before running VS.
Further technical details
EF Core version: 2.1.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.9.1
PS Version: 5.1.17763.134
The text was updated successfully, but these errors were encountered: