public static bool IsApplicationPortable(string entryAssemblyPath) { var runtimeConfigFile = Path.ChangeExtension(entryAssemblyPath, FileNameSuffixes.RuntimeConfigJson); if (File.Exists(runtimeConfigFile)) { var runtimeConfig = new RuntimeConfig(runtimeConfigFile); return runtimeConfig.IsPortable; } return false; }
private bool IsPortable(string executablePath) { var commandDir = Path.GetDirectoryName(executablePath); var runtimeConfigPath = Directory.EnumerateFiles(commandDir) .FirstOrDefault(x => x.EndsWith("runtimeconfig.json")); if (runtimeConfigPath == null) { return false; } var runtimeConfig = new RuntimeConfig(runtimeConfigPath); Console.WriteLine(runtimeConfig.Framework); return runtimeConfig.IsPortable; }
private bool IsPortableApp(string commandPath) { var commandDir = Path.GetDirectoryName(commandPath); var runtimeConfigPath = Directory.EnumerateFiles(commandDir) .FirstOrDefault(x => x.EndsWith("runtimeconfig.json")); if (runtimeConfigPath == null) { return false; } var runtimeConfig = new RuntimeConfig(runtimeConfigPath); return runtimeConfig.IsPortable; }