Skip to content

Commit

Permalink
- Codebase housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-shilo committed Jan 17, 2025
1 parent 146b5b8 commit f3ab244
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cd .\&#xD;&#xA;set ide=true&#xD;&#xA;&quot;$(TargetPath)&quot;" />
<!--<Exec Command="cd .\&#xD;&#xA;set ide=true&#xD;&#xA;&quot;$(TargetPath)&quot;" />-->
</Target>
</Project>
3 changes: 1 addition & 2 deletions Source/src/WixSharp.Samples/Wix# Samples/Build-MSIX/setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

static class Script
{
static public void Main()
static public void Main(string[] args)
{
var project =
new ManagedProject("MyProduct",
Expand All @@ -27,7 +27,6 @@ static public void Main()
TargetFileName = "app.exe"
}));

project.ManagedUI = ManagedUI.DefaultWpf;
project.GUID = new Guid("6fe30b47-2577-43ad-9a95-1861ba25889b");

var msi = project.BuildMsi();
Expand Down
25 changes: 13 additions & 12 deletions Source/src/WixSharp.Samples/Wix# Samples/Install Files/setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Security.Principal;
using System.Windows.Forms;
using System.Xml.Linq;
using WixSharp;
Expand All @@ -22,22 +23,22 @@ static public void Main()

var project =
new ManagedProject("MyProduct",
// new Dir(@"AppDataFolder\My ICompany\My Product",
new Dir(new Id("MY_INSTALLDIR"), @"%ProgramFiles%\My ICompany\My Product",
new Dir(@"%ProgramFiles%\My Company\My Product",
f = new File("MyApp_file".ToId(),
@"Files\Bin\MyApp.exe",
new FileAssociation("cstm", "application/custom", "open", "\"%1\"")
{
Advertise = true,
Icon = "wixsharp.ico"
})
{
TargetFileName = "app.exe"
},
@"Files\Bin\MyApp.exe",
new FileAssociation("cstm", "application/custom", "open", "\"%1\"")
{
Advertise = true,
Icon = "wixsharp.ico"
})
{
TargetFileName = "app.exe"
},
new Dir(@"Docs\Manual",
new File(@"Files\Docs\Manual.txt")
{
NeverOverwrite = true
NeverOverwrite = true,
Condition = new Condition("IS64=yes")
})),
new Property("PropName", "<your value>"));

Expand Down
90 changes: 72 additions & 18 deletions Source/src/WixSharp.Samples/Wix# Samples/testpad/setup.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//using PirrosLibrary;
//using Test1Library;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using static System.Net.Mime.MediaTypeNames;
using System.Security.Cryptography;
using WixSharp;
Expand All @@ -10,7 +11,7 @@ class Constants
public static string PluginVersion = "2.3.0";
}

namespace Pirros.installer.wixsharp
namespace Test1.installer.wixsharp
{
class Program
{
Expand All @@ -20,19 +21,72 @@ class Program
private static readonly string Configuration = "Release";
#endif

public static void Main()
static string companyName = "Demo Inc.";
static string productName = "DllExample";
static string productVersion = "1.0.0";

static void Main()
{
Environment.CurrentDirectory = @"D:\dev\wixsharp4\Source\src\WixSharp.Samples\Wix# Samples\Install Files";
var msixTemplate = @".\MyProduct.msix.xml";

var startInfo = new ProcessStartInfo
{
FileName = "MsixPackagingTool.exe",
Arguments = $@"create-package --template {msixTemplate} -v",
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};

try
{
using (Process process = Process.Start(startInfo))
{
string line = null;
while (null != (line = process.StandardOutput.ReadLine()))
Console.WriteLine(line);

string error = process.StandardError.ReadToEnd();
if (!error.IsEmpty())
Console.WriteLine(error);
process.WaitForExit();
}
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}

static void Main1()
{
var project = new ManagedProject(productName,
new Dir(@"%ProgramFiles%\" + companyName + @"\" + productName + @"\" + productVersion,
Files.FromBuildDir(@"D:\dev\support\wixsharp-issues\DllErrorExample\Contents")));

project.GUID = new Guid("5de17d40-9e25-49fe-a835-36d7e0b64062");
project.Version = new Version(productVersion);

project.ManagedUI = ManagedUI.DefaultWpf; // all stock UI dialogs

project.BuildMsi();
}

public static void Test1()
{
return; // REMOVE THIS LINE TO ENABLE BUILDING

Environment.CurrentDirectory = @"D:\dev\support\wixsharp-issues\Pirros\WixSharp Setup1\WixSharp Setup1";
Environment.CurrentDirectory = @"D:\dev\support\wixsharp-issues\Test1\WixSharp Setup1\WixSharp Setup1";
Constants.PluginVersion = "2.4.0";

string Version = Constants.PluginVersion; // READ FROM PIRROS LIBRARY
Guid ProductId = GenerateProductId("Pirros" + Constants.PluginVersion);
string Version = Constants.PluginVersion; // READ FROM Test1 LIBRARY
Guid ProductId = GenerateProductId("Test1" + Constants.PluginVersion);
Guid UpgradeCode = new Guid("6476F6DF-EB27-4CAB-9790-5FE5F1C39731"); // DO NOT TOUCH

Project project =
new Project("Pirros",
new Project("Test1",
new Media { EmbedCab = true }, // copied from old installer, don't know what it does
CreateRevitAddinDir(2020)// ,
// CreateRevitAddinDir(2021),
Expand All @@ -44,20 +98,20 @@ public static void Main()

project.Scope = InstallScope.perUser;

project.Name = "Pirros Revit Plugin";
project.Name = "Test1 Revit Plugin";
project.ProductId = ProductId;
project.UpgradeCode = UpgradeCode;
//project.GUID = new Guid("6476F6DF-EB27-4CAB-9790-5FE5F1C39735");

project.Version = new Version(Version);
project.Description = "Revit Plugin to interact with Pirros.com";
project.ControlPanelInfo.Manufacturer = "Pirros Inc";
project.Description = "Revit Plugin to interact with Test1.com";
project.ControlPanelInfo.Manufacturer = "Test1 Inc";
project.ControlPanelInfo.ProductIcon = @".\Assets\icon.ico";
project.ControlPanelInfo.UrlInfoAbout = "https://www.pirros.com";
project.ControlPanelInfo.UrlInfoAbout = "https://www.Test1.com";

project.MajorUpgrade = new MajorUpgrade
{
DowngradeErrorMessage = "A newer version of Pirros Plugin is already installed.",
DowngradeErrorMessage = "A newer version of Test1 Plugin is already installed.",
};

project.UI = WUI.WixUI_Minimal;
Expand All @@ -69,9 +123,9 @@ public static void Main()
{ "WixUIDialogBmp", @".\Assets\Background.png" }
};

project.OutFileName = $"Pirros.installer-V{Version}{(Configuration == "Debug" ? "-dev" : "")}";
project.OutFileName = $"Test1.installer-V{Version}{(Configuration == "Debug" ? "-dev" : "")}";

project.SourceBaseDir = @"D:\dev\support\wixsharp-issues\Pirros\WixSharp Setup1\WixSharp Setup1";
project.SourceBaseDir = @"D:\dev\support\wixsharp-issues\Test1\WixSharp Setup1\WixSharp Setup1";

// Compiler.PreserveTempFiles = true;
Compiler.EmitRelativePaths = false;
Expand All @@ -88,11 +142,11 @@ private static Dir CreateRevitAddinDir(int year)
string framework = GetFrameworkForYear(year);

return new Dir($@"%AppDataFolder%\Autodesk\Revit\Addins\{year}",
new File(@"..\Pirros\Pirros.addin"),
new Dir("Pirros",
Files.FromBuildDir($@"..\Pirros\bin\{Configuration}{year}\{framework}"),
new File(@"..\Test1\Test1.addin"),
new Dir("Test1",
Files.FromBuildDir($@"..\Test1\bin\{Configuration}{year}\{framework}"),
new Dir("Resources",
new Files(@"..\Pirros\Resources\*.*"))));
new Files(@"..\Test1\Resources\*.*"))));
}

private static Guid GenerateProductId(string input)
Expand Down
68 changes: 34 additions & 34 deletions Source/src/WixSharp.Samples/Wix# Samples/testpad/testpad.csproj
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>

<ItemGroup>
<None Remove="*.cmd" />
<None Remove="CustomAction.config" />
<None Remove="*.exe" />
<None Remove="*.pdb" />
<None Remove="*.wixpdb" />
<None Remove="*.msi" />
<Compile Remove="Files\Bin\MyApp.cs" />
<None Remove="readme.txt" />
<None Remove="*.cs.dll" />
<None Remove="WixSharp.CA.dll" />
<None Remove="wixsharp.ico" />
</ItemGroup>
<ItemGroup>
<None Remove="*.cmd" />
<None Remove="CustomAction.config" />
<None Remove="*.exe" />
<None Remove="*.pdb" />
<None Remove="*.wixpdb" />
<None Remove="*.msi" />
<Compile Remove="Files\Bin\MyApp.cs" />
<None Remove="readme.txt" />
<None Remove="*.cs.dll" />
<None Remove="WixSharp.CA.dll" />
<None Remove="wixsharp.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.2" />
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.2" />
<PackageReference Include="WixToolset.UI.wixext" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\WixSharp.MsiEventHost\WixSharp.MsiEventHost.csproj" />
<ProjectReference Include="..\..\..\WixSharp.Msi\WixSharp.Msi\WixSharp.Msi.csproj" />
<ProjectReference Include="..\..\..\WixSharp.UI.WPF\WixSharp.UI.WPF.csproj" />
<ProjectReference Include="..\..\..\WixSharp.UI\WixSharp.UI.csproj" />
<ProjectReference Include="..\..\..\WixSharp\WixSharp.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\WixSharp.MsiEventHost\WixSharp.MsiEventHost.csproj" />
<ProjectReference Include="..\..\..\WixSharp.Msi\WixSharp.Msi\WixSharp.Msi.csproj" />
<ProjectReference Include="..\..\..\WixSharp.UI.WPF\WixSharp.UI.WPF.csproj" />
<ProjectReference Include="..\..\..\WixSharp.UI\WixSharp.UI.csproj" />
<ProjectReference Include="..\..\..\WixSharp\WixSharp.csproj" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="cd .\&#xD;&#xA;set ide=true&#xD;&#xA;&quot;$(TargetPath)&quot;" />
</Target>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<!--<Exec Command="cd .\&#xD;&#xA;set ide=true&#xD;&#xA;&quot;$(TargetPath)&quot;" />-->
</Target>
</Project>
11 changes: 11 additions & 0 deletions Source/src/WixSharp.Suite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixSharp.MsiEventHost", "Wi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "testpad", "WixSharp.Samples\Wix# Samples\testpad\testpad.csproj", "{33B0F443-DE35-44E9-848A-42ECF653D782}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "build_msix", "WixSharp.Samples\Wix# Samples\Build-MSIX\build_msix.csproj", "{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1018,6 +1020,14 @@ Global
{33B0F443-DE35-44E9-848A-42ECF653D782}.Release|Any CPU.Build.0 = Release|Any CPU
{33B0F443-DE35-44E9-848A-42ECF653D782}.Release|x86.ActiveCfg = Release|Any CPU
{33B0F443-DE35-44E9-848A-42ECF653D782}.Release|x86.Build.0 = Release|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Debug|x86.ActiveCfg = Debug|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Debug|x86.Build.0 = Debug|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Release|Any CPU.Build.0 = Release|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Release|x86.ActiveCfg = Release|Any CPU
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1120,6 +1130,7 @@ Global
{B8FA0F17-1C07-4511-9FFA-3AD69B36B16C} = {DB40BEF1-64CF-4308-9740-AF22284F4491}
{A88C3698-8BD1-49C1-999C-020B5E9312E1} = {DB40BEF1-64CF-4308-9740-AF22284F4491}
{33B0F443-DE35-44E9-848A-42ECF653D782} = {DB40BEF1-64CF-4308-9740-AF22284F4491}
{B7EEE899-5CA9-48AB-94C0-04650D2CBC85} = {DB40BEF1-64CF-4308-9740-AF22284F4491}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {559711D5-4429-4577-BBC9-F0D973972079}
Expand Down
2 changes: 0 additions & 2 deletions Source/src/WixSharp.UI/ManagedUI/ManagedUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ public static string LocalizationFilesLocation

internal static string LocalizationFileFor(Project project)
{
// return UIExtensions.UserOrDefaultContentOf(project.LocalizationFile, project.SourceBaseDir, project.OutDir, project.Name + ".wxl", Resources.WixUI_en_us);

// - if localization file specified by the user then just return it but merge with
// the stock localization if found.
// - if user did not specify it then find the stock localization file (in SDK folder) for the language
Expand Down
5 changes: 3 additions & 2 deletions Source/src/WixSharp.UI/ManagedUI/MsiSessionAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using WixSharp.UI.Forms;
Expand Down Expand Up @@ -162,7 +163,7 @@ public void Log(string msg)
// issue. When part of the logging system does not work, it reduces
// analysis time when other parts are still fed with relevant messages.
//
List<Exception> exceptions = new List<Exception>();
var exceptions = new List<Exception>();

try
{
Expand Down Expand Up @@ -222,4 +223,4 @@ public string LogFile
}
}
}
}
}
5 changes: 5 additions & 0 deletions Source/src/WixSharp/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,11 @@ public enum VariableType
/// </summary>
@string,

/// <summary>
/// The formatted type
/// </summary>
formatted,

/// <summary>
/// The numeric type
/// </summary>
Expand Down
Loading

0 comments on commit f3ab244

Please sign in to comment.