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
I am testing this library in ASP.NET with .NET Framework 4.7.2 but the result is unexpected. The Load method always generates the same error:
.env: error: No such file or directory.
The problem is that this library uses the Directory.GetCurrentDirectory() method and this method is returning a path that does not correspond to the project path:
C:\Program Files\IIS Express
This problem has been mentioned here: dotnet/aspnetcore#4206.
As far as I can see, the Directory.GetCurrentDirectory() method works perfectly when you use it with .NET Framework 4.7.2, however, with ASP.NET it returns a path that does not correspond to the current directory of the application.
Note that the AppContext.BaseDirectory property returns the root directory of the project in ASP.NET Framework, on the other hand, in ASP.NET Core it returns the current directory of the application.
I am testing this library in ASP.NET with .NET Framework 4.7.2 but the result is unexpected. The
Load
method always generates the same error:The problem is that this library uses the Directory.GetCurrentDirectory() method and this method is returning a path that does not correspond to the project path:
This problem has been mentioned here: dotnet/aspnetcore#4206.
As far as I can see, the
Directory.GetCurrentDirectory()
method works perfectly when you use it with .NET Framework 4.7.2, however, with ASP.NET it returns a path that does not correspond to the current directory of the application.Temporary solution
The temporary solution I found was to use the AppContext.BaseDirectory property:
Note: This solution only works with dotenv.core >=
2.0.0
.The value representing the
AppContext.BaseDirectory
property is null in xamarin-android. This bug has not been fixed yet: dotnet/android#3489.The text was updated successfully, but these errors were encountered: