Skip to content

Commit 18f8006

Browse files
authored
[automated] Merge branch 'release/8.0.3xx' => 'main' (#18709)
2 parents 60ef6e4 + e41f391 commit 18f8006

File tree

6 files changed

+72
-6
lines changed

6 files changed

+72
-6
lines changed

src/VirtualMonoRepo/source-mappings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"name": "aspire",
6565
"defaultRemote": "https://github.com/dotnet/aspire",
6666
"exclude": [
67-
"src/Aspire.Dashboard/**/*"
67+
"src/Aspire.Dashboard/**/*",
68+
"samples/**/*"
6869
]
6970
},
7071
{

src/finalizer/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ target_link_libraries(Finalizer shell32.lib)
5555
target_link_libraries(Finalizer advapi32.lib)
5656
target_link_libraries(Finalizer version.lib)
5757
target_link_libraries(Finalizer msi.lib)
58+
target_link_libraries(Finalizer shlwapi.lib)
5859

5960
# Add WiX libraries
6061
target_link_libraries(Finalizer wcautil.lib)

src/finalizer/finalizer.cpp

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,64 @@ extern "C" HRESULT DetectSdk(LPWSTR sczSdkFeatureBandVersion, LPWSTR sczArchitec
492492
return hr;
493493
}
494494

495+
void RemoveInstallStateFile(LPWSTR sczSdkFeatureBandVersion, LPWSTR sczPlatform)
496+
{
497+
HRESULT hr = S_OK;
498+
LPWSTR sczProgramData = NULL;
499+
LPWSTR sczInstallStatePath = NULL;
500+
LPWSTR sczPath = NULL;
501+
502+
hr = ShelGetFolder(&sczProgramData, CSIDL_COMMON_APPDATA);
503+
ExitOnFailure(hr, "Failed to get shell folder.");
504+
505+
hr = PathConcat(sczProgramData, L"dotnet", &sczInstallStatePath);
506+
ExitOnFailure(hr, "Failed to concat dotnet to install state path.");
507+
508+
hr = PathConcat(sczInstallStatePath, L"workloads", &sczInstallStatePath);
509+
ExitOnFailure(hr, "Failed to concat workloads to install state path.");
510+
511+
hr = PathConcat(sczInstallStatePath, sczPlatform, &sczInstallStatePath);
512+
ExitOnFailure(hr, "Failed to concat platform (%ls) to install state path.", sczPlatform);
513+
514+
hr = PathConcat(sczInstallStatePath, sczSdkFeatureBandVersion, &sczInstallStatePath);
515+
ExitOnFailure(hr, "Failed to concat feature band (%ls) to install state path.", sczSdkFeatureBandVersion);
516+
517+
hr = PathConcat(sczInstallStatePath, L"installstate", &sczInstallStatePath);
518+
ExitOnFailure(hr, "Failed to concat installstate to install state path.");
519+
520+
hr = PathConcat(sczInstallStatePath, L"default.json", &sczInstallStatePath);
521+
ExitOnFailure(hr, "Failed to concat default.json to install state path.");
522+
523+
if (FileExistsEx(sczInstallStatePath, NULL))
524+
{
525+
LogStringLine(REPORT_STANDARD, "Deleting install state file: %ls", sczInstallStatePath);
526+
hr = FileEnsureDelete(sczInstallStatePath);
527+
ExitOnFailure(hr, "Failed to delete install state file: %ls", sczInstallStatePath);
528+
529+
hr = PathGetParentPath(sczInstallStatePath, &sczPath);
530+
ExitOnFailure(hr, "Failed to get parent path of install state file.");
531+
532+
LogStringLine(REPORT_STANDARD, "Cleaning up empty workload folders.");
533+
DirDeleteEmptyDirectoriesToRoot(sczPath, 0);
534+
}
535+
else
536+
{
537+
LogStringLine(REPORT_STANDARD, "Install state file does not exist: %ls", sczInstallStatePath);
538+
}
539+
540+
LExit:
541+
ReleaseStr(sczPath);
542+
ReleaseStr(sczInstallStatePath)
543+
ReleaseStr(sczProgramData);
544+
}
545+
495546
int wmain(int argc, wchar_t* argv[])
496547
{
497548
HRESULT hr = S_OK;
498549
DWORD dwExitCode = 0;
499550
LPWSTR sczDependent = NULL;
500551
LPWSTR sczFeatureBandVersion = NULL;
552+
LPWSTR sczPlatform = NULL;
501553
BOOL bRestartRequired = FALSE;
502554
BOOL bSdkFeatureBandInstalled = FALSE;
503555
int iMajor = 0;
@@ -507,16 +559,19 @@ int wmain(int argc, wchar_t* argv[])
507559
hr = ::Initialize(argc, argv);
508560
ExitOnFailure(hr, "Failed to initialize.");
509561

562+
hr = StrAllocString(&sczPlatform, argv[3], 0);
563+
ExitOnFailure(hr, "Failed to copy platform argument.");
564+
510565
// Convert the full SDK version to a feature band version
511566
hr = ParseSdkVersion(argv[2], &sczFeatureBandVersion);
512567
ExitOnFailure(hr, "Failed to parse version, %ls.", argv[2]);
513568

514569
// Create the dependent value, e.g., Microsoft.NET.Sdk,6.0.300,arm64
515-
hr = StrAllocFormatted(&sczDependent, L"Microsoft.NET.Sdk,%ls,%ls", sczFeatureBandVersion, argv[3]);
570+
hr = StrAllocFormatted(&sczDependent, L"Microsoft.NET.Sdk,%ls,%ls", sczFeatureBandVersion, sczPlatform);
516571
ExitOnFailure(hr, "Failed to create dependent.");
517572
LogStringLine(REPORT_STANDARD, "Setting target dependent to %ls.", sczDependent);
518573

519-
hr = ::DetectSdk(sczFeatureBandVersion, argv[3], &bSdkFeatureBandInstalled);
574+
hr = ::DetectSdk(sczFeatureBandVersion, sczPlatform, &bSdkFeatureBandInstalled);
520575
ExitOnFailure(hr, "Failed to detect installed SDKs.");
521576

522577
// If the feature band is still present, do not remove workloads.
@@ -529,17 +584,20 @@ int wmain(int argc, wchar_t* argv[])
529584
hr = ::RemoveDependent(sczDependent, &bRestartRequired);
530585
ExitOnFailure(hr, "Failed to remove dependent \"%ls\".", sczDependent);
531586

532-
hr = ::DeleteWorkloadRecords(sczFeatureBandVersion, argv[3]);
587+
hr = ::DeleteWorkloadRecords(sczFeatureBandVersion, sczPlatform);
533588
ExitOnFailure(hr, "Failed to remove workload records.");
534589

535590
if (bRestartRequired)
536591
{
537592
dwExitCode = ERROR_SUCCESS_REBOOT_REQUIRED;
538593
}
539594

595+
RemoveInstallStateFile(sczFeatureBandVersion, sczPlatform);
596+
540597
LExit:
541598
ReleaseStr(sczDependent);
542599
ReleaseStr(sczFeatureBandVersion);
600+
ReleaseStr(sczPlatform);
543601
LogUninitialize(TRUE);
544602
RegUninitialize();
545603
WiuUninitialize();

src/finalizer/precomp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <winreg.h>
1313
#include <msi.h>
1414
#include <pathcch.h>
15+
#include <shlobj.h>
16+
#include <shlwapi.h>
1517

1618
// Configure some logging parameters for WiX
1719
#define ExitTrace LogErrorString
@@ -26,3 +28,7 @@
2628
#include "pathutil.h"
2729
#include "strutil.h"
2830
#include "wiutil.h"
31+
#include "dirutil.h"
32+
#include "fileutil.h"
33+
#include "shelutil.h"
34+

src/finalizer_shim/finalizer_shim.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Microsoft.Signed.Wix" Version="$(WixPackageVersion)" GeneratePathProperty="true" />
15+
<!-- The MicrosoftSignedWixVersion property comes from the Arcade SDK DefaultVersions.props -->
16+
<PackageReference Include="Microsoft.Signed.Wix" Version="$(MicrosoftSignedWixVersion)" GeneratePathProperty="true" />
1617
</ItemGroup>
1718

1819
<ItemGroup>

src/redist/targets/GenerateMSIs.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<Target Name="SetupWixProperties" DependsOnTargets="GetCurrentRuntimeInformation">
44
<!-- AcquireWix Properties -->
55
<PropertyGroup>
6-
<WixVersion>$(WixPackageVersion)</WixVersion>
76
<WixDownloadUrl>https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/wix/Microsoft.Signed.Wix-$(WixVersion).zip</WixDownloadUrl>
87
<WixRoot>$(ArtifactsDir)Tools/WixTools/$(WixVersion)</WixRoot>
98
<WixDestinationPath>$(WixRoot)/WixTools.$(WixVersion).zip</WixDestinationPath>

0 commit comments

Comments
 (0)