Fix failing tests

This commit is contained in:
Caelan Sayler
2021-08-29 23:15:43 +01:00
parent 65a85343cf
commit 719b1ede32
3 changed files with 10 additions and 4 deletions

View File

@@ -18,7 +18,9 @@ namespace Squirrel
EntryExePath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
BaseDirectory = AppContext.BaseDirectory;
var assyPath = Assembly.GetEntryAssembly().Location;
// if Assembly.Location does not exist, we're almost certainly bundled into a dotnet SingleFile
// is there a better way to check for this?
var assyPath = (Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly())?.Location;
if (String.IsNullOrEmpty(assyPath) || !File.Exists(assyPath))
IsSingleFile = true;
}

View File

@@ -56,7 +56,11 @@ namespace Squirrel
var backingDll = originalFilename == null ? null
: Path.Combine(Path.GetDirectoryName(fullname), originalFilename);
return backingDll;
if (backingDll.EndsWith("dll", StringComparison.InvariantCultureIgnoreCase))
return backingDll;
return null;
}
static int? GetAssemblySquirrelAwareVersion(string executable)

View File

@@ -16,10 +16,10 @@ namespace Squirrel.Tests
{
#if DEBUG
private const string NativeBuildRootRelativePath = @"..\build\Debug\Win32\";
private const string ManagedBuildRootRelativePath = @"..\build\Debug\net45\";
private const string ManagedBuildRootRelativePath = @"..\build\Debug\net5.0\";
#else
private const string NativeBuildRootRelativePath = @"..\build\Release\Win32\";
private const string ManagedBuildRootRelativePath = @"..\build\Release\net45\";
private const string ManagedBuildRootRelativePath = @"..\build\Release\net5.0\";
#endif
[Fact]