Skip to content

Commit 8ce8382

Browse files
committed
First round of updates to WiX V6 as well as minor tweaks and alterations.
1 parent 6c92c5a commit 8ce8382

5 files changed

Lines changed: 41 additions & 26 deletions

File tree

GraphMailRelay/GraphMailRelay.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Worker">
22
<PropertyGroup>
3-
<TargetFramework>net7.0-windows</TargetFramework>
3+
<TargetFramework>net8.0-windows7.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<UserSecretsId>dotnet-GraphMailRelay-02bed99c-92e9-44c6-a1fa-3fc0a3747108</UserSecretsId>
@@ -14,16 +14,16 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Azure.Identity" Version="1.11.0" />
17+
<PackageReference Include="Azure.Identity" Version="1.17.1" />
1818
<PackageReference Include="McGuireV10.GenericHostBuilderLogger" Version="1.0.0" />
19-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
20-
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.0" />
21-
<PackageReference Include="Microsoft.Graph" Version="5.51.0" />
22-
<PackageReference Include="MimeKit" Version="4.3.0" />
23-
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.8.1" />
24-
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
25-
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.8.1" />
26-
<PackageReference Include="SmtpServer" Version="10.0.1" />
19+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.3" />
20+
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="10.0.3" />
21+
<PackageReference Include="Microsoft.Graph" Version="5.103.0" />
22+
<PackageReference Include="MimeKit" Version="4.15.0" />
23+
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.15.0" />
24+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.15.0" />
25+
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.15.0" />
26+
<PackageReference Include="SmtpServer" Version="11.1.0" />
2727
</ItemGroup>
2828

2929
<ItemGroup>

GraphMailRelay/GraphWorker.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ public async Task StartAsync(CancellationToken cancellationToken)
109109
{
110110
AuthorityHost = azureAuthorityHost
111111
});
112-
113112
var azureHttpClient = GraphClientFactory.Create(azureHandlers);
114-
var azureAuthProvider = new AzureIdentityAuthenticationProvider(azureCredentials);
113+
string[] azureScopes = [
114+
"https://graph.microsoft.com/.default"
115+
];
116+
var azureAuthProvider = new AzureIdentityAuthenticationProvider(azureCredentials, null, null, true, azureScopes);
115117
_graphServiceClient = new GraphServiceClient(azureHttpClient, azureAuthProvider, graphBaseUri.ToString());
116118

117119
// TODO: Validate that provide AzureMailUser exists and is valid so relay doesn't choke when trying to send real messages after startup.

GraphMailRelayInstaller/Components.wxs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,32 @@
1111
this back to a more dynamic setup.
1212
-->
1313
<ComponentGroup Id="GraphMailRelayComponents">
14+
<Files Include="!(bindpath.bin)**">
15+
<Exclude Files="!(bindpath.bin)GraphMailRelay.exe" />
16+
</Files>
17+
1418
<Component Id="GraphMailRelay" Directory="INSTALLFOLDER" Guid="*">
15-
<File Id="GraphMailRelay" Source="GraphMailRelay.exe" Vital="true"/>
19+
<File Id="GraphMailRelay" Source="!(bindpath.bin)GraphMailRelay.exe" Vital="true"/>
1620
<ServiceInstall Id="GraphMailRelayService"
1721
Name="GraphMailRelayService"
1822
DisplayName="Graph Mail Relay Service"
1923
Description="A simple relay service that accepts incoming mail on a configurable port and relays it via the Microsoft Graph API."
20-
Vital="true" Interactive="false" Start="auto" Type="ownProcess" ErrorControl="normal" Account="LocalSystem">
24+
Vital="true"
25+
Interactive="false"
26+
Start="auto"
27+
Type="ownProcess"
28+
ErrorControl="normal"
29+
Account="LocalSystem">
2130
<util:ServiceConfig FirstFailureActionType="restart"
2231
SecondFailureActionType="restart"
2332
ThirdFailureActionType="restart"
2433
ResetPeriodInDays="1"
2534
RestartServiceDelayInSeconds="60" />
2635
</ServiceInstall>
27-
36+
2837
<!--
2938
We can't have the service automatically start on install unless the installer accepts configuration parameters and
3039
can place them somewhere the application can access, such as the appsettings.json file or the registry.
31-
<ServiceControl Id="GraphMailRelayService" Name="GraphMailRelayService" Start="install" Stop="both" Remove="uninstall" />
3240
-->
3341
<ServiceControl Id="GraphMailRelayService" Name="GraphMailRelayService" Stop="both" Remove="uninstall" />
3442
</Component>
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
<Project Sdk="WixToolset.Sdk/4.0.0-rc.4">
1+
<Project Sdk="WixToolset.Sdk/6.0.2">
22
<ItemGroup>
3-
<ProjectReference Include="..\GraphMailRelay\GraphMailRelay.csproj" />
4-
<BindPath Include="..\GraphMailRelay\bin\Release\net7.0-windows\publish" />
3+
<BindPath Include="..\GraphMailRelay\bin\Release\net7.0-windows">
4+
<BindName>bin</BindName>
5+
</BindPath>
56
<BindVariable Include="WixUILicenseRtf=..\LICENSE.rtf" />
67
</ItemGroup>
78
<ItemGroup>
8-
<PackageReference Include="WixToolset.Heat" Version="4.0.0-rc.4" />
9-
<PackageReference Include="WixToolset.Netfx.wixext" Version="4.0.0-rc.4" />
10-
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.0-rc.4" />
11-
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.0-rc.4" />
9+
<PackageReference Include="WixToolset.Heat" Version="6.0.2" />
10+
<PackageReference Include="WixToolset.Netfx.wixext" Version="6.0.2" />
11+
<PackageReference Include="WixToolset.UI.wixext" Version="6.0.2" />
12+
<PackageReference Include="WixToolset.Util.wixext" Version="6.0.2" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<ProjectReference Include="..\GraphMailRelay\GraphMailRelay.csproj" />
1216
</ItemGroup>
1317
</Project>

GraphMailRelayInstaller/Package.wxs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
1+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
2+
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
23
<!-- Configure the package properties. -->
34
<!-- TODO: Figure out how to dynamically pull name, manufacturer, and version info from source project/output files. -->
4-
<Package Name="GraphMailRelay" Manufacturer="JM-A21" Version="1.1.4.0" Compressed="true" Scope="perMachine" UpgradeCode="b2ce958a-60cb-4cd3-99da-b57165023003">
5+
<Package Name="GraphMailRelay" Manufacturer="JM-A21" Version="1.1.5.0" Compressed="true" Scope="perMachine" UpgradeCode="b2ce958a-60cb-4cd3-99da-b57165023003">
56

67
<!-- Configure miscellaneous package options.-->
78
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
@@ -12,7 +13,7 @@
1213
<ComponentGroupRef Id="GraphMailRelayComponents" />
1314
</Feature>
1415

15-
<!-- Configure a custom action to open the configuration folder installation is complete. -->
16+
<!-- Configure a custom action to open the configuration folder once installation is complete. -->
1617
<Property Id="WixQuietExecCmdLine" Value='"explorer.exe" "[%PROGRAMDATA]\!(bind.Property.Manufacturer)\!(bind.Property.ProductName)"' />
1718
<CustomAction Id="CustomActionOpenCommonAppDataFolder" BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" DllEntry="WixQuietExec" Execute="immediate" Impersonate="true" Return="asyncWait"/>
1819

0 commit comments

Comments
 (0)