Skip to content

Commit

Permalink
Migrate to .NET 4.7.2, WIX v4 Custom Action, PackageReference and SDK…
Browse files Browse the repository at this point in the history
…-Style .csproj
  • Loading branch information
MCPC10 committed Feb 11, 2023
1 parent a16f3ce commit 06609fa
Show file tree
Hide file tree
Showing 33 changed files with 249 additions and 1,494 deletions.
146 changes: 26 additions & 120 deletions DaemonMaster.Core/DaemonMaster.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,121 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{144D809E-B1F7-43D9-BD94-806874C9E683}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DaemonMaster.Core</RootNamespace>
<AssemblyName>DaemonMaster.Core</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="DaemonMasterUtils.cs" />
<Compile Include="DmServiceDefinition.cs" />
<Compile Include="EventLogManager.cs" />
<Compile Include="Exceptions\ServiceNotStoppedException.cs" />
<Compile Include="Exceptions\ServiceStoppedException.cs" />
<Compile Include="Jobs\KillChildProcessJob.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RegistryManagement.cs" />
<Compile Include="Security.cs" />
<Compile Include="ServiceCommands.cs" />
<Compile Include="ServiceInfo.cs" />
<Compile Include="Win32\IWin32ServiceDefinition.cs" />
<Compile Include="Win32\JobHandle.cs" />
<Compile Include="Win32\LsaPolicyHandle.cs" />
<Compile Include="Win32\PInvoke\Advapi32\Advapi32.cs" />
<Compile Include="Win32\PInvoke\Advapi32\Advapi32Helpers.cs" />
<Compile Include="Win32\PInvoke\Advapi32\QUERY_SERVICE_CONFIG.cs" />
<Compile Include="Win32\PInvoke\Kernel32\CreationFlags.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ErrorControl.cs" />
<Compile Include="Win32\PInvoke\Advapi32\LogonProvider.cs" />
<Compile Include="Win32\PInvoke\Advapi32\LogonType.cs" />
<Compile Include="Win32\PInvoke\Advapi32\LsaObjectAttributes.cs" />
<Compile Include="Win32\PInvoke\Advapi32\LsaUnicodeString.cs" />
<Compile Include="Win32\PInvoke\Kernel32\ProcessInformation.cs" />
<Compile Include="Win32\PInvoke\Kernel32\ProcessStartInfo.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ScAction.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ScActionType.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceAccessRights.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceConfigDelayedAutoStartInfo.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceConfigDescription.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceConfigFailureActions.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceConfigFailureActionsFlag.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceControl.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceControlManagerAccessRights.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceFailureActions.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceInfoLevel.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceStartType.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceState.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceStatus.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceStatusProcess.cs" />
<Compile Include="Win32\PInvoke\Advapi32\ServiceType.cs" />
<Compile Include="Win32\PInvoke\Advapi32\SecurityImpersonationLevel.cs" />
<Compile Include="Win32\PInvoke\Advapi32\TokenType.cs" />
<Compile Include="Win32\PInvoke\NtStatus.cs" />
<Compile Include="Win32\PInvoke\Kernel32\AccessMask.cs" />
<Compile Include="Win32\PInvoke\Kernel32\CtrlEvent.cs" />
<Compile Include="Win32\PInvoke\Kernel32\IoCounters.cs" />
<Compile Include="Win32\PInvoke\Kernel32\JobObjectBasicLimitInfo.cs" />
<Compile Include="Win32\PInvoke\Kernel32\JobObjectExtendedLimitInfo.cs" />
<Compile Include="Win32\PInvoke\Kernel32\JobObjectInfoType.cs" />
<Compile Include="Win32\PInvoke\Kernel32\JobObjectLimit.cs" />
<Compile Include="Win32\PInvoke\Kernel32\Kernel32.cs" />
<Compile Include="Win32\PInvoke\Kernel32\Kernel32Helper.cs" />
<Compile Include="Win32\PInvoke\Kernel32\SecurityAttributes.cs" />
<Compile Include="Win32\PInvoke\Kernel32\ThreadAccess.cs" />
<Compile Include="Win32\PInvoke\Userenv\Userenv.cs" />
<Compile Include="Win32\PInvoke\Win32ErrorCodes.cs" />
<Compile Include="Win32\PInvoke\Winsta\Winsta.cs" />
<Compile Include="Win32\PInvoke\Wtsapi32\Wtsapi32.cs" />
<Compile Include="Win32\PInvoke\Wtsapi32\WtsConnectstateClass.cs" />
<Compile Include="Win32\PInvoke\Wtsapi32\WtsInfoClass.cs" />
<Compile Include="Win32\PInvoke\Wtsapi32\WtsSessionInfo.cs" />
<Compile Include="Win32\ServiceControlManager.cs" />
<Compile Include="Win32\ServiceCredentials.cs" />
<Compile Include="Win32\ServiceHandle.cs" />
<Compile Include="Win32\ShellLinkWrapper.cs" />
<Compile Include="Win32\TokenHelper.cs" />
<Compile Include="Win32\Win32Sid.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net472</TargetFramework>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
<PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if $(ConfigurationName) == Release del *.pdb" />
</Target>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
36 changes: 0 additions & 36 deletions DaemonMaster.Core/Properties/AssemblyInfo.cs

This file was deleted.

4 changes: 0 additions & 4 deletions DaemonMaster.Core/packages.config

This file was deleted.

37 changes: 11 additions & 26 deletions DaemonMaster.CustomActions/CustomAction.config
Original file line number Diff line number Diff line change
@@ -1,32 +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 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 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.
</startup>
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.
<!--
Add additional configuration settings here. For more information on application config files,
see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx
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>
4 changes: 2 additions & 2 deletions DaemonMaster.CustomActions/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand All @@ -7,8 +8,7 @@
using DaemonMaster.Core.Win32;
using DaemonMaster.Core.Win32.PInvoke.Advapi32;
using DaemonMasterService;
using Microsoft.Deployment.WindowsInstaller;
using Microsoft.Win32;
using WixToolset.Dtf.WindowsInstaller;

namespace DaemonMaster.CustomActions
{
Expand Down
65 changes: 12 additions & 53 deletions DaemonMaster.CustomActions/DaemonMaster.CustomActions.csproj
Original file line number Diff line number Diff line change
@@ -1,61 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B35B7602-2C46-40C4-A0AB-21C6C1401CF3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DaemonMaster.CustomActions</RootNamespace>
<AssemblyName>DaemonMaster.CustomActions</AssemblyName>
<TargetFrameworkVersion>v4.6.1</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>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.Deployment.WindowsInstaller">
<Private>True</Private>
</Reference>
<Content Include="CustomAction.config" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<Compile Include="CustomAction.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="CustomAction.config" />
<PackageReference Include="WixToolset.Dtf.CustomAction" Version="4.0.0-rc.2" />
<PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.0-rc.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DaemonMaster.Core\DaemonMaster.Core.csproj">
<Project>{144d809e-b1f7-43d9-bd94-806874c9e683}</Project>
<Name>DaemonMaster.Core</Name>
</ProjectReference>
<ProjectReference Include="..\DaemonMaster.Core\DaemonMaster.Core.csproj" />
</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>

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
35 changes: 0 additions & 35 deletions DaemonMaster.CustomActions/Properties/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion DaemonMaster.Updater/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
</configuration>
Loading

0 comments on commit 06609fa

Please sign in to comment.