Open kglundgren opened 1 month ago
I tried changing the code to this, using ExeFileShortcut instead, but it still doesn't work:
using System.Runtime.CompilerServices;
using WixSharp;
using File = WixSharp.File;
[assembly: InternalsVisibleTo(assemblyName: "WixSharp_MSI_Installer.aot")] // assembly name + '.aot suffix
static string GetRootDir([CallerFilePath] string filePath = "") =>
$@"{Path.GetDirectoryName(filePath)!}\..";
var projectName = "MyApp";
var mainExe = $"{projectName}.exe";
string rootDir = GetRootDir();
var appPublishDir = $@"{rootDir}\build\app-x64-rel";
var buildDir = $@"{rootDir}\build\wix";
if (!Directory.Exists(buildDir)) Directory.CreateDirectory(buildDir);
Directory.GetFiles(buildDir).ForEach(System.IO.File.Delete);
var installerResources = $@"{rootDir}\WixSharp_MSI_Installer\Resources";
var project = new ManagedProject(projectName,
new Dir($@"%ProgramFiles%\MyOrg AB\{projectName}",
new Files(@"*.*", f => !f.EndsWith(mainExe)),
new File(sourcePath: $@"{appPublishDir}\{mainExe}")),
new Dir("%Desktop%",
new ExeFileShortcut(name: projectName, target: $@"[INSTALLDIR]{mainExe}", arguments: "")
{
WorkingDirectory = "[INSTALLDIR]" }
))
{
Platform = Platform.x64,
GUID = new Guid("33f767ca-a96f-48f7-9fc9-30b2aa777489"),
SourceBaseDir = appPublishDir,
OutDir = buildDir,
LicenceFile = $@"{installerResources}\CustomLicense.rtf",
};
project.BuildMsi();
Wait, it does work... The shortcuts are just placed in C:\Users\Public\Desktop
. I had no idea this directory even existed!
Hello,
As the title says, I can't place a shortcut on the desktop to the main exe. This is my code:
That gives me this warning and error:
I tried changing
WorkingDirectory
of the shortcut to theinstallDirId
and then I don't get any errors but the shortcut is not created.I've tried looking for the documentation on how to create shortcuts but haven't been able to find any, if there are I apologize. I tried looking at the samples and copying them but they didn't help either.