Minor fixes for msbuild task

This commit is contained in:
Caelan Sayler
2024-03-11 11:19:14 +00:00
parent 40558a25d6
commit ede3a6b12e
4 changed files with 9 additions and 4 deletions

View File

@@ -83,7 +83,8 @@ public class PackTask : MSBuildAsyncTask
{
//System.Diagnostics.Debugger.Launch();
HelperFile.ClearSearchPaths();
HelperFile.AddSearchPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", "..", "vendor");
var searchPath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "..", "..", "vendor"));
HelperFile.AddSearchPath(searchPath);
if (VelopackRuntimeInfo.IsWindows) {
var options = this.ToWinPackOptions();

View File

@@ -184,6 +184,10 @@ public class WindowsPackCommandRunner : PackageBuilder<WindowsPackOptions>
private void CreateExecutableStubForExe(string exeToCopy, string targetStubPath)
{
if (!File.Exists(exeToCopy)) {
throw new ArgumentException($"Cannot create StubExecutable for '{exeToCopy}' because it does not exist.");
}
try {
Utility.Retry(() => File.Copy(HelperFile.StubExecutablePath, targetStubPath, true));
Utility.Retry(() => {

View File

@@ -115,7 +115,7 @@ public static class HelperFile
var result = files.FirstOrDefault();
if (result == null && throwWhenNotFound)
throw new Exception($"Could not find '{toFind}'.");
throw new Exception($"HelperFile could not find '{toFind}'.");
return result;
}

View File

@@ -48,7 +48,7 @@ public abstract class PackageBuilder<T> : ICommand<T>
throw new UserInfoException($"To build packages for {SupportedTargetOs.GetOsLongName()}, " +
$"the target rid must be {SupportedTargetOs} (actually was {options.TargetRuntime?.BaseRID}).");
Log.Info("Beginning to package release.");
Log.Info($"Beginning to package Velopack release {options.PackVersion}.");
Log.Info("Releases Directory: " + options.ReleaseDir.FullName);
var releaseDir = options.ReleaseDir;
@@ -86,8 +86,8 @@ public abstract class PackageBuilder<T> : ICommand<T>
);
}
MainExeName = mainExeName;
MainExePath = mainExePath;
MainExeName = Path.GetFileName(mainExePath);
using var _1 = Utility.GetTempDirectory(out var pkgTempDir);
TempDir = new DirectoryInfo(pkgTempDir);