Merge pull request #2617 from schellap/fx-deps-file
Determine FX dir using FX_DEPS_FILE
This commit is contained in:
commit
3d8cbba932
2 changed files with 17 additions and 3 deletions
|
@ -28,7 +28,8 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
if (_hostDir == null)
|
if (_hostDir == null)
|
||||||
{
|
{
|
||||||
_hostDir = Path.GetDirectoryName(typeof(object).GetTypeInfo().Assembly.Location);
|
var fxDepsFile = Muxer.GetDataFromAppDomain("FX_DEPS_FILE");
|
||||||
|
_hostDir = Path.GetDirectoryName(fxDepsFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return _hostDir;
|
return _hostDir;
|
||||||
|
|
|
@ -33,11 +33,24 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetDataFromAppDomain(string propertyName)
|
||||||
|
{
|
||||||
|
var appDomainType = typeof(object).GetTypeInfo().Assembly?.GetType("System.AppDomain");
|
||||||
|
var currentDomain = appDomainType?.GetProperty("CurrentDomain")?.GetValue(null);
|
||||||
|
var deps = appDomainType?.GetMethod("GetData")?.Invoke(currentDomain, new[] { propertyName });
|
||||||
|
|
||||||
|
return deps as string;
|
||||||
|
}
|
||||||
|
|
||||||
private bool TryResolveMuxerFromParentDirectories()
|
private bool TryResolveMuxerFromParentDirectories()
|
||||||
{
|
{
|
||||||
var appBase = new FileInfo(typeof(object).GetTypeInfo().Assembly.Location);
|
var fxDepsFile = GetDataFromAppDomain("FX_DEPS_FILE");
|
||||||
var muxerDir = appBase.Directory?.Parent?.Parent?.Parent;
|
if (string.IsNullOrEmpty(fxDepsFile))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var muxerDir = new FileInfo(fxDepsFile).Directory?.Parent?.Parent?.Parent;
|
||||||
if (muxerDir == null)
|
if (muxerDir == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue