mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Update publish profiles.
This commit is contained in:
parent
bc2a6187cc
commit
e4291713eb
@ -25,7 +25,7 @@ namespace Remotely.Agent.Installer.Win.ViewModels
|
||||
|
||||
private int progress;
|
||||
|
||||
private string serverUrl = "";
|
||||
private string serverUrl;
|
||||
|
||||
private string statusMessage;
|
||||
|
||||
|
||||
@ -25,7 +25,9 @@ namespace Remotely.Desktop.Win.Wrapper
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly string tempDir = Directory.CreateDirectory(PathIO.Combine(PathIO.GetTempPath(), "Remotely_Desktop")).FullName;
|
||||
private static readonly string baseDir = Directory.CreateDirectory(PathIO.Combine(PathIO.GetTempPath(), "Remotely_Desktop")).FullName;
|
||||
private string tempDir;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -46,19 +48,42 @@ namespace Remotely.Desktop.Win.Wrapper
|
||||
DragMove();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ExtractRemotely();
|
||||
ExtractInstallScript();
|
||||
RunInstallScript();
|
||||
StatusText.Text = "Extracting files...";
|
||||
await Task.Run(CleanupOldFiles);
|
||||
tempDir = Directory.CreateDirectory(PathIO.Combine(baseDir, Guid.NewGuid().ToString())).FullName;
|
||||
await Task.Run(ExtractRemotely);
|
||||
await Task.Run(ExtractInstallScript);
|
||||
StatusText.Text = "Updating .NET Core runtime...";
|
||||
await Task.Run(RunInstallScript);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CleanupOldFiles()
|
||||
{
|
||||
foreach (var fse in Directory.GetFileSystemEntries(baseDir))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(fse))
|
||||
{
|
||||
Directory.Delete(fse, true);
|
||||
}
|
||||
else if (File.Exists(fse))
|
||||
{
|
||||
File.Delete(fse);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtractRemotely()
|
||||
{
|
||||
try
|
||||
{
|
||||
StatusText.Text = "Extracting files...";
|
||||
var zipPath = PathIO.Combine(tempDir, "Remotely_Desktop.zip");
|
||||
using (var mrs = Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream("Remotely.Desktop.Win.Wrapper.Remotely_Desktop.zip"))
|
||||
@ -70,23 +95,34 @@ namespace Remotely.Desktop.Win.Wrapper
|
||||
}
|
||||
ZipFile.ExtractToDirectory(zipPath, tempDir);
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("An error occured while extracting files. Error: " +
|
||||
Environment.NewLine + Environment.NewLine + ex.Message, "Error",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void RunInstallScript()
|
||||
{
|
||||
try
|
||||
{
|
||||
StatusText.Text = "Updating .NET Core runtime...";
|
||||
var installPath = PathIO.Combine(tempDir, "Install.ps1");
|
||||
Process.Start(new ProcessStartInfo()
|
||||
{
|
||||
FileName = "powershell.exe",
|
||||
Arguments = $"-executionpolicy bypass -f \"{installPath}\"",
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
});
|
||||
}).WaitForExit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("An error occured while updating .NET Core. Error: " +
|
||||
Environment.NewLine + Environment.NewLine + ex.Message, "Error",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void ExtractInstallScript()
|
||||
@ -103,7 +139,11 @@ namespace Remotely.Desktop.Win.Wrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("An error occured while extracting files. Error: " +
|
||||
Environment.NewLine + Environment.NewLine + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
Desktop.Win/Properties/PublishProfiles/wrapper-x64.pubxml
Normal file
17
Desktop.Win/Properties/PublishProfiles/wrapper-x64.pubxml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PublishDir>bin\Release\win-x64\publish\</PublishDir>
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<PublishSingleFile>False</PublishSingleFile>
|
||||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -8,7 +8,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<PublishDir>bin\x64\Release\publish\</PublishDir>
|
||||
<PublishDir>bin\Release\win-x86\publish\</PublishDir>
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win10-x86</RuntimeIdentifier>
|
||||
<PublishSingleFile>False</PublishSingleFile>
|
||||
@ -9,20 +9,20 @@
|
||||
<div class="text-info col-sm-12 pl-0 mb-2">
|
||||
Instant desktop sharing. No account required.
|
||||
</div>
|
||||
@*<div class="col-sm-6 mb-3">
|
||||
<div class="col-sm-6 mb-3">
|
||||
<h6>Windows (64-Bit)</h6>
|
||||
<p>
|
||||
<strong>Download:</strong>
|
||||
<br />
|
||||
<a href="~/Downloads/Win-x64/Remotely_Desktop.exe">Windows EXE</a>
|
||||
</p>
|
||||
</div>*@
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<h6>Windows (64/32-Bit)</h6>
|
||||
<h6>Windows (32-Bit)</h6>
|
||||
<p>
|
||||
<strong>Download:</strong>
|
||||
<br />
|
||||
<a href="~/Downloads/Remotely_Desktop.exe">Windows EXE</a>
|
||||
<a href="~/Downloads/Win-x86/Remotely_Desktop.exe">Windows EXE</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm-6 mb-3">
|
||||
|
||||
@ -80,7 +80,7 @@ Set-Content -Path "$Root\Server\CurrentVersion.txt" -Value $CurrentVersion.Trim(
|
||||
if ($Hostname.Length -gt 0) {
|
||||
Replace-LineInFile -FilePath "$Root\Desktop.Win\Services\Config.cs" -MatchPattern "public string Host " -ReplaceLineWith "public string Host { get; set; } = `"$($Hostname)`";" -MaxCount 1
|
||||
Replace-LineInFile -FilePath "$Root\Desktop.Linux\Services\Config.cs" -MatchPattern "public string Host " -ReplaceLineWith "public string Host { get; set; } = `"$($Hostname)`";" -MaxCount 1
|
||||
Replace-LineInFile -FilePath "$Root\Agent.Installer.Win\ViewModels\MainWindowViewModel.cs" -MatchPattern "private string serverUrl;" -ReplaceLineWith "private string serverUrl = `"$($Hostname)`";" -MaxCount 1
|
||||
Replace-LineInFile -FilePath "$Root\Agent.Installer.Win\ViewModels\MainWindowViewModel.cs" -MatchPattern "private string serverUrl" -ReplaceLineWith "private string serverUrl = `"$($Hostname)`";" -MaxCount 1
|
||||
}
|
||||
else {
|
||||
Write-Host "`nWARNING: No hostname parameter was specified. The server name will need to be entered manually in the desktop client.`n" -ForegroundColor DarkYellow
|
||||
@ -122,26 +122,38 @@ dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:Publ
|
||||
# Publish Windows ScreenCaster (64-bit)
|
||||
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:PublishProfile=win-x64 --configuration Release "$Root\ScreenCast.Win"
|
||||
|
||||
|
||||
# Publish Windows GUI App (64-bit)
|
||||
#dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:PublishProfile=win-x64 --configuration Release "$Root\Desktop.Win"
|
||||
|
||||
#if ($SignAssemblies) {
|
||||
# &"$Root\Utilities\signtool.exe" sign /f "$CertificatePath" /p $CertificatePassword /t http://timestamp.digicert.com "$Root\Server\wwwroot\Downloads\Win-x64\Remotely_Desktop.exe"
|
||||
#}
|
||||
|
||||
# Publish Windows GUI App (32-bit)
|
||||
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:PublishProfile=Wrapper --configuration Release "$Root\Desktop.Win"
|
||||
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:PublishProfile=wrapper-x64 --configuration Release "$Root\Desktop.Win"
|
||||
if (Test-Path -Path "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip"){
|
||||
Remove-Item -Path "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip" -Force
|
||||
}
|
||||
Get-ChildItem -Path "$Root\Desktop.Win\bin\x64\Release\publish\" | ForEach-Object {
|
||||
Get-ChildItem -Path "$Root\Desktop.Win\bin\Release\win-x64\publish\" | ForEach-Object {
|
||||
Compress-Archive -Path $_.FullName -DestinationPath "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip" -Update
|
||||
}
|
||||
&"$MSBuildPath" "$Root\Desktop.Win.Wrapper" /t:Build /p:Configuration=Release /p:Platform=AnyCPU /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion
|
||||
|
||||
&"$MSBuildPath" "$Root\Desktop.Win.Wrapper" /t:Build /p:Configuration=Release /p:Platform=x64 /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion
|
||||
if ($SignAssemblies) {
|
||||
&"$Root\Utilities\signtool.exe" sign /f "$CertificatePath" /p $CertificatePassword /t http://timestamp.digicert.com "$Root\Desktop.Win.Wrapper\bin\Release\Remotely_Desktop.exe"
|
||||
&"$Root\Utilities\signtool.exe" sign /f "$CertificatePath" /p $CertificatePassword /t http://timestamp.digicert.com "$Root\Desktop.Win.Wrapper\bin\x64\Release\Remotely_Desktop.exe"
|
||||
}
|
||||
Copy-Item -Path "$Root\Desktop.Win.Wrapper\bin\Release\Remotely_Desktop.exe" -Destination "$Root\Server\wwwroot\Downloads\Remotely_Desktop.exe" -Force
|
||||
Copy-Item -Path "$Root\Desktop.Win.Wrapper\bin\x64\Release\Remotely_Desktop.exe" -Destination "$Root\Server\wwwroot\Downloads\Win-x64\Remotely_Desktop.exe" -Force
|
||||
|
||||
|
||||
# Publish Windows GUI App (32-bit)
|
||||
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion -p:PublishProfile=wrapper-x86 --configuration Release "$Root\Desktop.Win"
|
||||
if (Test-Path -Path "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip"){
|
||||
Remove-Item -Path "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip" -Force
|
||||
}
|
||||
Get-ChildItem -Path "$Root\Desktop.Win\bin\Release\win-x86\publish\" | ForEach-Object {
|
||||
Compress-Archive -Path $_.FullName -DestinationPath "$Root\Desktop.Win.Wrapper\Remotely_Desktop.zip" -Update
|
||||
}
|
||||
|
||||
&"$MSBuildPath" "$Root\Desktop.Win.Wrapper" /t:Build /p:Configuration=Release /p:Platform=x86 /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion
|
||||
if ($SignAssemblies) {
|
||||
&"$Root\Utilities\signtool.exe" sign /f "$CertificatePath" /p $CertificatePassword /t http://timestamp.digicert.com "$Root\Desktop.Win.Wrapper\bin\x86\Release\Remotely_Desktop.exe"
|
||||
}
|
||||
Copy-Item -Path "$Root\Desktop.Win.Wrapper\bin\x86\Release\Remotely_Desktop.exe" -Destination "$Root\Server\wwwroot\Downloads\Win-x86\Remotely_Desktop.exe" -Force
|
||||
|
||||
|
||||
# Build installer.
|
||||
&"$MSBuildPath" "$Root\Agent.Installer.Win" /t:Restore
|
||||
|
||||
Loading…
Reference in New Issue
Block a user