Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .net core target .exes #1692

Closed
wants to merge 3 commits into from
Closed
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
22 changes: 20 additions & 2 deletions src/Squirrel/SquirrelAwareExecutableDetector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,27 @@ public static List<string> GetAllSquirrelAwareApps(string directory, int minimum
{
if (!File.Exists(executable)) return null;
var fullname = Path.GetFullPath(executable);
var backingDll = fullname.Substring(0, fullname.Length - 3) + "dll";

return Utility.Retry<int?>(() =>
{
var assemblySquirrelAwareVersion = GetAssemblySquirrelAwareVersion(fullname);
if (assemblySquirrelAwareVersion != null)
{
return assemblySquirrelAwareVersion;
}

if (File.Exists(backingDll))
{
var assemblyDllSquirrelAwareVersion = GetAssemblySquirrelAwareVersion(backingDll);
if (assemblyDllSquirrelAwareVersion != null)
{
return assemblyDllSquirrelAwareVersion;
}
}

return Utility.Retry<int?>(() =>
GetAssemblySquirrelAwareVersion(fullname) ?? GetVersionBlockSquirrelAwareValue(fullname));
return GetVersionBlockSquirrelAwareValue(fullname);
});
}

static int? GetAssemblySquirrelAwareVersion(string executable)
Expand Down
10 changes: 9 additions & 1 deletion test/SquirrelAwareExecutableDetectorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ public void SquirrelAwareViaLanguageNeutralVersionBlock()
Assert.True(File.Exists(target));

var ret = SquirrelAwareExecutableDetector.GetPESquirrelAwareVersion(target);

Assert.NotNull(ret);
Assert.Equal(1, ret.Value);
}

[Fact]
public void SquirrelAwareViaNetCoreAssemblyAttribute()
{
var target = IntegrationTestHelper.GetPath("fixtures", "SquirrelAwareNetCoreApp.exe");
Assert.True(File.Exists(target));

var ret = SquirrelAwareExecutableDetector.GetPESquirrelAwareVersion(target);
Assert.Equal(1, ret.Value);
}

[Fact]
public void SquirrelAwareViaAssemblyAttribute()
Expand Down
Binary file added test/fixtures/SquirrelAwareNetCoreApp.dll
Binary file not shown.
Binary file added test/fixtures/SquirrelAwareNetCoreApp.exe
Binary file not shown.