diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a0afeba4..e46ddf0c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -572,8 +572,8 @@ jobs: echo "dagent-package=$DAgentPackage" >> $Env:GITHUB_OUTPUT - $DAgentPedmDesktopExecutable = Join-Path $TargetOutputPath "DevolutionsPedmDesktop.exe" - echo "dagent-pedm-desktop-executable=$DAgentPedmDesktopExecutable" >> $Env:GITHUB_OUTPUT + $DAgentDesktopAgentOutputPath = Join-Path $TargetOutputPath "DesktopAgent" + echo "dagent-desktop-agent-output-path=$DAgentDesktopAgentOutputPath" >> $Env:GITHUB_OUTPUT $DAgentPedmShellExtDll = Join-Path $TargetOutputPath "DevolutionsPedmShellExt.dll" echo "dagent-pedm-shell-ext-dll=$DAgentPedmShellExtDll" >> $Env:GITHUB_OUTPUT @@ -648,7 +648,7 @@ jobs: CARGO_PACKAGE: devolutions-agent run: | if ($Env:RUNNER_OS -eq "Windows") { - $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-pedm-desktop-executable }}" + $Env:DAGENT_DESKTOP_AGENT_OUTPUT_PATH = "${{ steps.load-variables.outputs.dagent-desktop-agent-output-path }}" $Env:DAGENT_PEDM_SHELL_EXT_DLL = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-dll }}" $Env:DAGENT_PEDM_SHELL_EXT_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-msix }}" $Env:DAGENT_SESSION_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-session-executable }}" @@ -665,7 +665,7 @@ jobs: run: | if ($Env:RUNNER_OS -eq "Windows") { $Env:DAGENT_PACKAGE = "${{ steps.load-variables.outputs.dagent-package }}" - $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-pedm-desktop-executable }}" + $Env:DAGENT_DESKTOP_AGENT_OUTPUT_PATH = "${{ steps.load-variables.outputs.dagent-desktop-agent-output-path }}" $Env:DAGENT_PEDM_SHELL_EXT_DLL = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-dll }}" $Env:DAGENT_PEDM_SHELL_EXT_MSIX = "${{ steps.load-variables.outputs.dagent-pedm-shell-ext-msix }}" $Env:DAGENT_SESSION_EXECUTABLE = "${{ steps.load-variables.outputs.dagent-session-executable }}" diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index c21df204b..ba940f29e 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -228,7 +228,7 @@ jobs: $IncludePattern = switch ('${{ matrix.project }}') { 'devolutions-gateway' { 'DevolutionsGateway_*.exe' } 'devolutions-agent' { 'DevolutionsAgent_*.exe', 'DevolutionsPedmShellExt.dll', - 'DevolutionsPedmShellExt.msix', 'DevolutionsPedmDesktop.exe' } + 'DevolutionsPedmShellExt.msix', 'DevolutionsDesktopAgent.exe' } 'jetsocat' { 'jetsocat_*' } } $ExcludePattern = "*.pdb" @@ -300,6 +300,15 @@ jobs: name: native-libs path: native-libs + - name: Zip debug symbol files + if: matrix.project == 'devolutions-agent' && matrix.os == 'windows' + shell: pwsh + run: | + $PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}} + + Get-ChildItem "$PackageRoot\windows\x86_64\*.pdb" -Recurse | Compress-Archive -DestinationPath "$PackageRoot\windows\x86_64\DevolutionsAgent-x86_64-${{ needs.preflight.outputs.version }}.symbols.zip" -CompressionLevel Optimal + Get-ChildItem "$PackageRoot\windows\x86_64\*.pdb" -Recurse | Remove-Item | Out-Null + - name: Regenerate Gateway MSI if: matrix.project == 'devolutions-gateway' && matrix.os == 'windows' shell: pwsh @@ -322,7 +331,7 @@ jobs: run: | $PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}} $Env:DAGENT_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include '*DevolutionsAgent*.exe' | Select -First 1 - $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmDesktop.exe' | Select -First 1 + $Env:DAGENT_DESKTOP_AGENT_OUTPUT_PATH = Join-Path $PackageRoot ${{ matrix.os }} x86_64 DesktopAgent $Env:DAGENT_PEDM_SHELL_EXT_DLL = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmShellExt.dll' | Select -First 1 $Env:DAGENT_PEDM_SHELL_EXT_MSIX = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsPedmShellExt.msix' | Select -First 1 $Env:DAGENT_SESSION_EXECUTABLE = Get-ChildItem -Path $PackageRoot -Recurse -Include 'DevolutionsSession.exe' | Select -First 1 @@ -426,19 +435,6 @@ jobs: } } - - name: Zip debug symbol files - if: matrix.project == 'devolutions-agent' && matrix.os == 'windows' - shell: pwsh - run: | - $PackageRoot = Join-Path ${{ runner.temp }} ${{ matrix.project}} - - Get-ChildItem -Path $PackageRoot -Recurse - - Compress-Archive "$PackageRoot\windows\x86_64\*.pdb" "$PackageRoot\windows\x86_64\DevolutionsAgent-x86_64-${{ needs.preflight.outputs.version }}.symbols.zip" -CompressionLevel Optimal - Remove-Item "$PackageRoot\windows\x86_64\*.pdb" | Out-Null - - Get-ChildItem -Path $PackageRoot -Recurse - - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/ci/tlk.ps1 b/ci/tlk.ps1 index 8eedd5599..15f98eedb 100755 --- a/ci/tlk.ps1 +++ b/ci/tlk.ps1 @@ -489,15 +489,17 @@ class TlkRecipe } if ($this.Product -Eq "agent" -And $this.Target.IsWindows()) { - & './crates/devolutions-pedm/DevolutionsPedmDesktop/build.ps1' | Out-Host + if (Test-Path Env:DAGENT_DESKTOP_AGENT_OUTPUT_PATH) { + & './dotnet/DesktopAgent/build.ps1' | Out-Host + $DesktopAgentOutputPath = $Env:DAGENT_DESKTOP_AGENT_OUTPUT_PATH + Remove-Item -Path "$DesktopAgentOutputPath" -Recurse -Force -ErrorAction SilentlyContinue + New-Item -Path "$DesktopAgentOutputPath" -ItemType 'Directory' -Force | Out-Null - if (Test-Path Env:DAGENT_PEDM_DESKTOP_EXECUTABLE) { - $builtDesktopExe = Get-ChildItem -Recurse -Include 'DevolutionsPedmDesktop.exe' | Select-Object -First 1 - $builtDesktopPdb = Get-ChildItem -Recurse -Include 'DevolutionsPedmDesktop.pdb' | Select-Object -First 1 - - Copy-Item -Path $builtDesktopExe -Destination $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE - Copy-Item -Path $builtDesktopPdb -Destination $(Get-DestinationSymbolFile $Env:DAGENT_PEDM_DESKTOP_EXECUTABLE $this.Target) + $BuiltDesktop = Get-ChildItem -Path "./dotnet/DesktopAgent/bin/Release/*" -Recurse -Include *.dll,*.exe,*.pdb + foreach ($File in $BuiltDesktop) { + Copy-Item $File.FullName -Destination $DesktopAgentOutputPath + } } if (Test-Path Env:DAGENT_SESSION_EXECUTABLE) { diff --git a/dotnet/DesktopAgent/build.ps1 b/dotnet/DesktopAgent/build.ps1 new file mode 100644 index 000000000..fafa7460e --- /dev/null +++ b/dotnet/DesktopAgent/build.ps1 @@ -0,0 +1,9 @@ +#!/bin/env pwsh + +$ErrorActionPreference = "Stop" + +Push-Location -Path $PSScriptRoot + +& 'MSBuild.exe' "/t:restore,build" "/p:Configuration=Release" | Out-Host + +Pop-Location diff --git a/package/AgentWindowsManaged/Dialogs/FeaturesDialog.Designer.cs b/package/AgentWindowsManaged/Dialogs/FeaturesDialog.Designer.cs index c46698490..589975326 100644 --- a/package/AgentWindowsManaged/Dialogs/FeaturesDialog.Designer.cs +++ b/package/AgentWindowsManaged/Dialogs/FeaturesDialog.Designer.cs @@ -59,8 +59,8 @@ private void InitializeComponent() // // middlePanel // - this.middlePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.middlePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.middlePanel.Controls.Add(this.descriptionPanel); this.middlePanel.Controls.Add(this.featuresTree); @@ -73,7 +73,7 @@ private void InitializeComponent() // // descriptionPanel // - this.descriptionPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.descriptionPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.descriptionPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.descriptionPanel.Controls.Add(this.description); @@ -84,8 +84,8 @@ private void InitializeComponent() // // description // - this.description.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.description.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.description.BackColor = System.Drawing.SystemColors.Control; this.description.Location = new System.Drawing.Point(0, 0); @@ -95,8 +95,8 @@ private void InitializeComponent() // // featuresTree // - this.featuresTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.featuresTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.featuresTree.CheckBoxes = true; this.featuresTree.Location = new System.Drawing.Point(14, 28); @@ -132,7 +132,7 @@ private void InitializeComponent() // // topBorder // - this.topBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.topBorder.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.topBorder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.topBorder.Location = new System.Drawing.Point(0, 58); @@ -142,7 +142,7 @@ private void InitializeComponent() // // topPanel // - this.topPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.topPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.topPanel.BackColor = System.Drawing.SystemColors.Control; this.topPanel.Controls.Add(this.label2); @@ -157,6 +157,7 @@ private void InitializeComponent() // this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; + this.label2.ForeColor = System.Drawing.SystemColors.HighlightText; this.label2.Location = new System.Drawing.Point(18, 31); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(130, 13); @@ -168,6 +169,7 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.ForeColor = System.Drawing.SystemColors.HighlightText; this.label1.Location = new System.Drawing.Point(10, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(116, 13); @@ -176,8 +178,8 @@ private void InitializeComponent() // // banner // - this.banner.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.banner.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.banner.BackColor = System.Drawing.Color.White; this.banner.Location = new System.Drawing.Point(0, 0); @@ -189,7 +191,7 @@ private void InitializeComponent() // // bottomPanel // - this.bottomPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.bottomPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.bottomPanel.BackColor = System.Drawing.SystemColors.Control; this.bottomPanel.Controls.Add(this.tableLayoutPanel1); @@ -259,7 +261,7 @@ private void InitializeComponent() // // border1 // - this.border1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.border1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.border1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.border1.Location = new System.Drawing.Point(0, 0); @@ -269,6 +271,7 @@ private void InitializeComponent() // // FeaturesDialog // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.ClientSize = new System.Drawing.Size(494, 361); this.Controls.Add(this.middlePanel); this.Controls.Add(this.topBorder); diff --git a/package/AgentWindowsManaged/Dialogs/FeaturesDialog.cs b/package/AgentWindowsManaged/Dialogs/FeaturesDialog.cs index 442a151f2..588d3eb71 100644 --- a/package/AgentWindowsManaged/Dialogs/FeaturesDialog.cs +++ b/package/AgentWindowsManaged/Dialogs/FeaturesDialog.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Windows.Forms; using DevolutionsAgent.Dialogs; @@ -30,46 +29,24 @@ void FeaturesDialog_Load(object sender, System.EventArgs e) if (drawTextOnlyProp.IsNotEmpty()) { if (string.Compare(drawTextOnlyProp, "false", true) == 0) + { drawTextOnly = false; + } } else { float dpi = CreateGraphics().DpiY; + if (dpi == 96) // the checkbox custom drawing is only compatible with 96 DPI + { drawTextOnly = false; + } } ReadOnlyTreeNode.Behavior.AttachTo(featuresTree, drawTextOnly); banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner"); BuildFeaturesHierarchy(); - - ResetLayout(); - } - - void ResetLayout() - { - // The form controls are properly anchored and will be correctly resized on parent form - // resizing. However the initial sizing by WinForm runtime doesn't a do good job with DPI - // other than 96. Thus manual resizing is the only reliable option apart from going WPF. - - float ratio = (float)banner.Image.Width / (float)banner.Image.Height; - topPanel.Height = (int)(banner.Width / ratio); - topBorder.Top = topPanel.Height + 1; - - var upShift = (int)(next.Height * 2.3) - bottomPanel.Height; - bottomPanel.Top -= upShift; - bottomPanel.Height += upShift; - - middlePanel.Top = topBorder.Bottom + 5; - middlePanel.Height = (bottomPanel.Top - 5) - middlePanel.Top; - - featuresTree.Width = (int)((middlePanel.Width / 3.0) * 1.75); - - descriptionPanel.Left = featuresTree.Right + 10; - descriptionPanel.Width = middlePanel.Width - descriptionPanel.Left - 10; - - featuresTree.Nodes[0].EnsureVisible(); } /// @@ -82,7 +59,7 @@ void ResetLayout() /// public static List InitialUserSelectedItems { get; private set; } - void BuildFeaturesHierarchy() + private void BuildFeaturesHierarchy() { features = Runtime.Session.Features; @@ -110,7 +87,9 @@ void BuildFeaturesHierarchy() item.View = view; if (item.Parent != null && item.Display != FeatureDisplay.hidden) + { (item.Parent.View as TreeNode).Nodes.Add(view); //link child view to parent view + } // even if the item is hidden process all its children so the correct hierarchy is established @@ -123,10 +102,14 @@ void BuildFeaturesHierarchy() }); if (UserSelectedItems != null) + { view.Checked = UserSelectedItems.Contains((view.Tag as FeatureItem).Name); + } if (item.Display == FeatureDisplay.expand) + { view.Expand(); + } } //add views to the treeView control @@ -143,7 +126,7 @@ void BuildFeaturesHierarchy() isAutoCheckingActive = true; } - void SaveUserSelection() + private void SaveUserSelection() { UserSelectedItems = features.Where(x => x.IsViewChecked()) .Select(x => x.Name) @@ -151,12 +134,12 @@ void SaveUserSelection() .ToList(); } - void featuresTree_AfterSelect(object sender, TreeViewEventArgs e) + private void featuresTree_AfterSelect(object sender, TreeViewEventArgs e) { description.Text = e.Node.FeatureItem().Description.LocalizeWith(Runtime.Localize); } - void featuresTree_AfterCheck(object sender, TreeViewEventArgs e) + private void featuresTree_AfterCheck(object sender, TreeViewEventArgs e) { if (isAutoCheckingActive) { @@ -186,7 +169,7 @@ void featuresTree_AfterCheck(object sender, TreeViewEventArgs e) } } - void reset_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + private void reset_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { isAutoCheckingActive = false; features.ForEach(f => f.ResetViewChecked()); diff --git a/package/AgentWindowsManaged/Program.cs b/package/AgentWindowsManaged/Program.cs index f7c94589f..7a6b800a4 100644 --- a/package/AgentWindowsManaged/Program.cs +++ b/package/AgentWindowsManaged/Program.cs @@ -2,7 +2,9 @@ using DevolutionsAgent.Dialogs; using DevolutionsAgent.Properties; using DevolutionsAgent.Resources; + using Microsoft.Deployment.WindowsInstaller; + using System; using System.Collections.Generic; using System.Diagnostics; @@ -14,11 +16,11 @@ using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml; + using WixSharp; -using WixSharp.Bootstrapper; using WixSharp.CommonTasks; using WixSharpSetup.Dialogs; -using Action = WixSharp.Action; + using Assembly = System.Reflection.Assembly; using CompressionLevel = WixSharp.CompressionLevel; using File = WixSharp.File; @@ -29,95 +31,65 @@ internal class Program { private const string PackageName = "DevolutionsAgent"; - private static string DevolutionsAgentExePath + /// Used for development builds only + private static string ResolveDirectory(string varName, string defaultPath = null) { - get - { - string path = Environment.GetEnvironmentVariable("DAGENT_EXECUTABLE"); + string path = Environment.GetEnvironmentVariable(varName); - if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) - { + if (string.IsNullOrEmpty(path) || !Directory.Exists(path)) + { #if DEBUG - path = "..\\..\\target\\x86_64-pc-windows-msvc\\release\\devolutionsagent.exe"; + path = defaultPath; #else - throw new Exception("The environment variable DAGENT_EXECUTABLE is not specified or the file does not exist"); + throw new FileNotFoundException($"The environment variable {varName} is not specified or the directory does not exist"); #endif - } - - if (!System.IO.File.Exists(path)) - { - throw new FileNotFoundException("The agent executable was not found", path); - } - - return path; } - } - private static string TargetOutputPath - { - get + if (!Directory.Exists(path)) { - string path = Environment.GetEnvironmentVariable("TARGET_OUTPUT_PATH"); - - if (string.IsNullOrEmpty(path) || !Directory.Exists(path)) - { -#if DEBUG - path = "..\\..\\target\\x86_64-pc-windows-msvc\\release\\"; -#else - throw new Exception("The environment variable TARGET_OUTPUT_PATH is not specified or the directory does not exist"); -#endif - } - - if (!Directory.Exists(path)) - { - throw new FileNotFoundException("The target output path was not found", path); - } - - return path; + throw new DirectoryNotFoundException($"The directory for {varName} was not found"); } + + return path; } - private static string DevolutionsAgentPedmDesktopExecutable + /// Used for development builds only + private static string ResolveArtifact(string varName, string defaultPath = null) { - get - { - string path = Environment.GetEnvironmentVariable("DAGENT_PEDM_DESKTOP_EXECUTABLE"); + string path = Environment.GetEnvironmentVariable(varName); - if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) - { + if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) + { #if DEBUG - path = "..\\..\\crates\\devolutions-pedm\\DevolutionsPedmDesktop\\bin\\Release\\net8.0-windows\\DevolutionsPedmDesktop.exe"; + path = defaultPath; #else - throw new Exception("The environment variable DAGENT_PEDM_DESKTOP_EXECUTABLE is not specified or the file does not exist"); + throw new FileNotFoundException($"The environment variable {varName} is not specified or the file does not exist"); #endif - } - - if (!System.IO.File.Exists(path)) - { - throw new FileNotFoundException("The agent PEDM desktop executable was not found", path); - } - - return path; } - } - - private static string ResolveArtifact(string varName, string error) - { - string path = Environment.GetEnvironmentVariable(varName); if (!System.IO.File.Exists(path)) { - throw new FileNotFoundException(error, path); + throw new FileNotFoundException($"The file for {varName} was not found", path); } return path; } - private static string DevolutionsPedmShellExtDll => ResolveArtifact("DAGENT_PEDM_SHELL_EXT_DLL", "The PEDM shell extension DLL was not found"); + private static string DevolutionsAgentExePath => ResolveArtifact("DAGENT_EXECUTABLE", "..\\..\\target\\x86_64-pc-windows-msvc\\release\\devolutions-agent.exe"); + + private static string DevolutionsDesktopAgentPath + { + // ReSharper disable once ArrangeAccessorOwnerBody + get => ResolveDirectory("DAGENT_DESKTOP_AGENT_OUTPUT_PATH", "..\\..\\dotnet\\DesktopAgent\\bin\\Release\\"); + } + + private static string DevolutionsPedmShellExtDll => ResolveArtifact("DAGENT_PEDM_SHELL_EXT_DLL", "..\\..\\target\\x86_64-pc-windows-msvc\\release\\devolutions_pedm_shell_ext.dll"); + + private static string DevolutionsPedmShellExtMsix => ResolveArtifact("DAGENT_PEDM_SHELL_EXT_MSIX", "..\\..\\target\\x86_64-pc-windows-msvc\\release\\DevolutionsPedmShellExt.msix"); - private static string DevolutionsPedmShellExtMsix => ResolveArtifact("DAGENT_PEDM_SHELL_EXT_MSIX", "The PEDM shell extension MSIX was not found"); + private static string DevolutionsSession => ResolveArtifact("DAGENT_SESSION_EXECUTABLE", "..\\..\\target\\x86_64-pc-windows-msvc\\release\\devolutions-session.exe"); - private static string DevolutionsSession => ResolveArtifact("DAGENT_SESSION_EXECUTABLE", "The Devolutions Session executable was not found"); + private static string TargetOutputPath => ResolveDirectory("TARGET_OUTPUT_PATH", "..\\..\\target\\x86_64-pc-windows-msvc\\release\\"); private static Version DevolutionsAgentVersion { @@ -285,13 +257,7 @@ static void Main() }, Dirs = new[] { - new Dir(Includes.PEDM_FEATURE, "desktop") - { - Files = new File[] - { - new (Includes.PEDM_FEATURE, DevolutionsAgentPedmDesktopExecutable), - } - } + new Dir(Includes.PEDM_FEATURE, "desktop", new Files($"{DevolutionsDesktopAgentPath}\\*.*")) } })), }; @@ -413,7 +379,6 @@ string I18n(string key) Version thisVersion = e.Session.QueryProductVersion(); Version installedVersion = Helpers.AppSearch.InstalledVersion; - if (thisVersion < installedVersion) { MessageBox.Show($"{I18n(Strings.NewerInstalled)} ({installedVersion})");