-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented "upgrade"-logic (user can change port/service-name... whe…
…n upgrading and sees the current values)
- Loading branch information
Showing
9 changed files
with
250 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{C01A4B05-BE4B-460F-9DF4-D431505721DF}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CA_ReadConfig</RootNamespace> | ||
<AssemblyName>CA_ReadConfig</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="Microsoft.Deployment.WindowsInstaller"> | ||
<Private>True</Private> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="CustomAction.cs" /> | ||
<Compile Include="IniFile.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Content Include="CustomAction.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " /> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " /> | ||
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixCATargetsImported)' != 'true' "> | ||
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?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 Microsoft.Deployment.WindowsInstaller.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. | ||
Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0. | ||
In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies | ||
by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true". | ||
For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx | ||
--> | ||
|
||
<supportedRuntime version="v4.0" /> | ||
<supportedRuntime version="v2.0.50727"/> | ||
|
||
</startup> | ||
|
||
<!-- | ||
Add additional configuration settings here. For more information on application config files, | ||
see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx | ||
--> | ||
|
||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.Deployment.WindowsInstaller; | ||
|
||
namespace CA_ReadConfig | ||
{ | ||
public class CustomActions | ||
{ | ||
[CustomAction] | ||
public static ActionResult ReadHost(Session session) | ||
{ | ||
var config = GetConfig(session["CONFIG_FILE"]); | ||
|
||
session["SERVICE_HOST"] = config.IniReadValue("default", "host"); | ||
|
||
return ActionResult.Success; | ||
} | ||
|
||
[CustomAction] | ||
public static ActionResult ReadPort(Session session) | ||
{ | ||
var config = GetConfig(session["CONFIG_FILE"]); | ||
|
||
session["SERVICE_PORT"] = config.IniReadValue("default", "port"); | ||
|
||
return ActionResult.Success; | ||
} | ||
|
||
private static INIFile GetConfig(string path) | ||
{ | ||
return new INIFile(path); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Text; | ||
using System.Runtime.InteropServices; | ||
|
||
|
||
namespace CA_ReadConfig | ||
{ | ||
public class INIFile | ||
{ | ||
public string path { get; private set; } | ||
|
||
[DllImport("kernel32")] | ||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); | ||
[DllImport("kernel32")] | ||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); | ||
|
||
public INIFile(string INIPath) | ||
{ | ||
path = INIPath; | ||
} | ||
public void IniWriteValue(string Section, string Key, string Value) | ||
{ | ||
WritePrivateProfileString(Section, Key, Value, path); | ||
} | ||
|
||
public string IniReadValue(string Section, string Key) | ||
{ | ||
StringBuilder temp = new StringBuilder(255); | ||
int i = GetPrivateProfileString(Section, Key, "", temp, 255, path); | ||
return temp.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("CA_ReadConfig")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyCompany("Meusburger Georg GmbH")] | ||
[assembly: AssemblyProduct("CA_ReadConfig")] | ||
[assembly: AssemblyCopyright("Copyright © Meusburger Georg GmbH 2019")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("c01a4b05-be4b-460f-9df4-d431505721df")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters