-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize WOW64 in TouchFile custom action
Fixes 8638
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 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
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,8 @@ | ||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
<Package Name="~TouchFile" Version="1.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
<Component> | ||
<File Source="$(sys.SOURCEFILEPATH)" /> | ||
<util:TouchFile Path="[LocalAppDataFolder]touch-file-test.txt" /> | ||
</Component> | ||
</Package> | ||
</Wix> |
6 changes: 6 additions & 0 deletions
6
src/test/msi/TestData/TouchFileTests/TouchFile/TouchFile.wixproj
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,6 @@ | ||
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
<Project Sdk="WixToolset.Sdk"> | ||
<ItemGroup> | ||
<PackageReference Include="WixToolset.Util.wixext" /> | ||
</ItemGroup> | ||
</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,48 @@ | ||
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
|
||
namespace WixToolsetTest.MsiE2E; | ||
|
||
using System; | ||
using System.IO; | ||
using WixTestTools; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
public class TouchFileTests : MsiE2ETests | ||
{ | ||
public TouchFileTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) | ||
{ | ||
} | ||
|
||
[RuntimeFact] | ||
public void CanValidateTouchFile() | ||
{ | ||
var touchFileTestPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "touch-file-test.txt"); | ||
|
||
try | ||
{ | ||
var touchFileTime = new DateTime(2004, 4, 5, 0, 0, 0, DateTimeKind.Utc); | ||
|
||
File.WriteAllText(touchFileTestPath, "This file exists to test CanValidateTouchFile()"); | ||
File.SetCreationTimeUtc(touchFileTestPath, touchFileTime); | ||
File.SetLastAccessTimeUtc(touchFileTestPath, touchFileTime); | ||
File.SetLastWriteTimeUtc(touchFileTestPath, touchFileTime); | ||
|
||
var product = this.CreatePackageInstaller("TouchFile"); | ||
|
||
var justBeforeInstall = DateTime.UtcNow; | ||
product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
|
||
var touchFile = new FileInfo(touchFileTestPath); | ||
Assert.Equal(touchFileTime, touchFile.CreationTimeUtc); | ||
Assert.Equal(touchFileTime, touchFile.LastAccessTimeUtc); | ||
Assert.True(touchFile.LastWriteTimeUtc >= justBeforeInstall, $"Touch file {touchFileTestPath} last write time: {touchFile.LastWriteTimeUtc} of file should have been updated to at least: {justBeforeInstall}"); | ||
|
||
product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
} | ||
finally | ||
{ | ||
File.Delete(touchFileTestPath); | ||
} | ||
} | ||
} |