Skip to content

Commit

Permalink
Don't rename App.dll to App.exe. (#349)
Browse files Browse the repository at this point in the history
* Don't rename App.dll to App.exe, so only App.dll is used.
  • Loading branch information
CartBlanche committed Sep 26, 2023
1 parent e403926 commit fe794a7
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions Meadow.CLI.Core/Devices/MeadowLocalDevice.FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,40 +577,40 @@ public async Task DeployApp(string applicationFilePath,
return;
}

await DeleteTemporaryFiles(cancellationToken);

var fi = new FileInfo(applicationFilePath);
var directoryName = fi.DirectoryName ?? string.Empty;
var meadowDll = Path.Combine(directoryName, "Meadow.dll");

if (!File.Exists(meadowDll))
{
Logger.LogError($"{meadowDll} not found.");
return;
}

var fileName = fi.Name;
var fileNamePdb = Path.Combine(directoryName, "App.pdb");

await DeleteTemporaryFiles(cancellationToken);

var deviceFiles = await GetFilesAndCrcs(
DefaultTimeout,
cancellationToken: cancellationToken);

//rename App.dll to App.exe
var fileNameDll = Path.Combine(fi.DirectoryName, "App.dll");
var fileNameExe = Path.Combine(fi.DirectoryName, "App.exe");
var fileNamePdb = Path.Combine(fi.DirectoryName, "App.pdb");

if (File.Exists(fileNameDll))
{
if (File.Exists(fileNameExe))
{
File.Delete(fileNameExe);
}
File.Copy(fileNameDll, fileNameExe);
}

foreach (var f in deviceFiles)
{
Logger.LogInformation($"Found {f.FileName} (CRC: {f.Crc})" + Environment.NewLine);
}

var binaries = Directory.EnumerateFiles(fi.DirectoryName, "*.*", SearchOption.TopDirectoryOnly)
var binaries = Directory.EnumerateFiles(directoryName, "*.*", SearchOption.TopDirectoryOnly)
.Where(s => new FileInfo(s).Extension != ".dll")
.Where(s => new FileInfo(s).Extension != ".pdb");
// .Where(s => extensions.Contains(new FileInfo(s).Extension));

var files = new Dictionary<string, uint>();

// Add the App.dll
await AddFile(Path.Combine(directoryName, fileName), false);

if (includePdbs)
{
await AddFile(fileNamePdb, false);
Expand Down Expand Up @@ -647,12 +647,12 @@ async Task AddFile(string file, bool includePdbs)
}
}

var dependencies = AssemblyManager.GetDependencies(fi.Name, fi.DirectoryName, osVersion)
var dependencies = AssemblyManager.GetDependencies(fileName, directoryName, osVersion)
.Where(x => x.Contains("App.") == false)
// .Where(x => dllLinkIngoreList.Any(f => x.Contains(f)) == false)
.ToList();

var trimmedDependencies = await AssemblyManager.TrimDependencies(fi.Name, fi.DirectoryName, dependencies, noLink, Logger, includePdbs: includePdbs, verbose: verbose);
var trimmedDependencies = await AssemblyManager.TrimDependencies(fileName, directoryName, dependencies, noLink, Logger, includePdbs: includePdbs, verbose: verbose);

//add local files (this includes App.exe)
foreach (var file in binaries)
Expand Down Expand Up @@ -760,7 +760,7 @@ await DeployApp(applicationFilePath,
}
else
{
Logger.LogInformation($"{Environment.NewLine}{fi.Name} deploy complete!{Environment.NewLine}");
Logger.LogInformation($"{Environment.NewLine}{fileName} deploy complete!{Environment.NewLine}");
}
}
catch (Exception ex)
Expand Down

0 comments on commit fe794a7

Please sign in to comment.