Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion ILSpy/AboutPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void Display(DecompilerTextView textView)
};
output.WriteLine(Resources.ILSpyVersion + DecompilerVersionInfo.FullVersion);

string prodVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(Uri).Assembly.Location).ProductVersion;
string prodVersion = GetDotnetProductVersion();
output.WriteLine(Resources.NETFrameworkVersion + prodVersion);

output.AddUIElement(
Expand Down Expand Up @@ -104,6 +104,27 @@ public static void Display(DecompilerTextView textView)
textView.ShowText(output);
}

private static string GetDotnetProductVersion()
{
// In case of AOT .Location is null, we need a fallback for that
string assemblyLocation = typeof(Uri).Assembly.Location;

if (!String.IsNullOrWhiteSpace(assemblyLocation))
{
return System.Diagnostics.FileVersionInfo.GetVersionInfo(assemblyLocation).ProductVersion;
}
else
{
var version = typeof(Object).Assembly.GetName().Version;
if (version != null)
{
return version.ToString();
}
}

return "UNKNOWN";
}

sealed class MyLinkElementGenerator : LinkElementGenerator
{
readonly Uri uri;
Expand Down
14 changes: 10 additions & 4 deletions ILSpy/ILSpySettingsFilePathProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ public string GetSettingsFilePath()
{
if (App.CommandLineArguments.ConfigFile != null)
return App.CommandLineArguments.ConfigFile;
string localPath = Path.Combine(Path.GetDirectoryName(typeof(MainWindow).Assembly.Location), "ILSpy.xml");
if (File.Exists(localPath))
return localPath;
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode\\ILSpy.xml");

var assemblyLocation = typeof(MainWindow).Assembly.Location;
if (!String.IsNullOrWhiteSpace(assemblyLocation))
{
string localPath = Path.Combine(Path.GetDirectoryName(assemblyLocation), "ILSpy.xml");
if (File.Exists(localPath))
return localPath;
}

return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ICSharpCode", "ILSpy.xml");
}
}
}