mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-08 13:11:29 +03:00
Feat. msi (#7584)
* Feat. msi Signed-off-by: fufesou <shuanglongchen@yeah.net> * remove ununsed file Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
17
res/msi/CustomActions/CustomAction.config
Normal file
17
res/msi/CustomActions/CustomAction.config
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup useLegacyV2RuntimeActivationPolicy="true">
|
||||
<!--
|
||||
Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that
|
||||
the custom action should run on. If no versions are specified, the chosen version of the runtime
|
||||
will be the "best" match to what WixToolset.Dtf.CustomAction.dll was built against.
|
||||
|
||||
WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility
|
||||
problems with future versions of the .NET Framework runtime. It is highly recommended that you specify
|
||||
only the version(s) of the .NET Framework runtime that you have tested against.
|
||||
|
||||
For more information https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/startup/startup-element
|
||||
-->
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
56
res/msi/CustomActions/CustomAction.cs
Normal file
56
res/msi/CustomActions/CustomAction.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using WixToolset.Dtf.WindowsInstaller;
|
||||
|
||||
namespace CustomActions
|
||||
{
|
||||
public class CustomActions
|
||||
{
|
||||
[CustomAction]
|
||||
public static ActionResult CustomActionHello(Session session)
|
||||
{
|
||||
try
|
||||
{
|
||||
session.Log("================= Example CustomAction Hello");
|
||||
return ActionResult.Success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
session.Log("An error occurred: " + e.Message);
|
||||
return ActionResult.Failure;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomAction]
|
||||
public static ActionResult RunCommandAsSystem(Session session)
|
||||
{
|
||||
try
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
|
||||
FileName = "cmd.exe",
|
||||
Arguments = "/c " + session["CMD"],
|
||||
UseShellExecute = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
Verb = "runas"
|
||||
};
|
||||
|
||||
using (Process process = Process.Start(psi))
|
||||
{
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
return ActionResult.Success;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
session.Log("An error occurred: " + e.Message);
|
||||
return ActionResult.Failure;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
res/msi/CustomActions/CustomActions.csproj
Normal file
15
res/msi/CustomActions/CustomActions.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<Configurations>Release</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="CustomAction.config" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="4.0.5" />
|
||||
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.5" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user