1- // Licensed to the .NET Foundation under one or more agreements.
1+ // Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
33
44namespace Microsoft . DotNet . Cli . Workload . Restore . Tests ;
@@ -15,9 +15,9 @@ public GivenDotnetWorkloadRestore(ITestOutputHelper log) : base(log)
1515 [ Fact ]
1616 public void ProjectsThatDoNotSupportWorkloadsAreNotInspected ( )
1717 {
18- var testDir = _testAssetsManager . CreateTestDirectory ( ) . Path ;
19- var cliHome = Path . Combine ( testDir , ".home" ) ;
20- var metadataDir = Path . Combine ( testDir , ".metadata" ) ;
18+ var cliHome = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) ) ;
19+ Directory . CreateDirectory ( cliHome ) ;
20+ File . Create ( Path . Combine ( cliHome , "userlocal" ) ) . Dispose ( ) ;
2121
2222 var projectPath =
2323 _testAssetsManager
@@ -28,8 +28,6 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
2828 new DotnetWorkloadCommand ( Log , "restore" )
2929 . WithWorkingDirectory ( projectPath )
3030 . WithEnvironmentVariable ( "DOTNET_CLI_HOME" , cliHome )
31- . WithEnvironmentVariable ( "DOTNET_WORKLOAD_METADATA_DIR" , metadataDir )
32- . WithEnvironmentVariable ( "DOTNET_SKIP_WORKLOAD_VERIFICATION" , "true" )
3331 . Execute ( )
3432 . Should ( )
3533 // if we did try to restore the dcproj in this TestAsset we would fail, so passing means we didn't!
@@ -39,9 +37,9 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected()
3937 [ Fact ]
4038 public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild ( )
4139 {
42- var testDir = _testAssetsManager . CreateTestDirectory ( ) . Path ;
43- var cliHome = Path . Combine ( testDir , ".home" ) ;
44- var metadataDir = Path . Combine ( testDir , ".metadata" ) ;
40+ var cliHome = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) ) ;
41+ Directory . CreateDirectory ( cliHome ) ;
42+ File . Create ( Path . Combine ( cliHome , "userlocal" ) ) . Dispose ( ) ;
4543
4644 var projectPath =
4745 _testAssetsManager
@@ -52,8 +50,6 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr
5250 new DotnetWorkloadCommand ( Log , "restore" )
5351 . WithWorkingDirectory ( projectPath )
5452 . WithEnvironmentVariable ( "DOTNET_CLI_HOME" , cliHome )
55- . WithEnvironmentVariable ( "DOTNET_WORKLOAD_METADATA_DIR" , metadataDir )
56- . WithEnvironmentVariable ( "DOTNET_SKIP_WORKLOAD_VERIFICATION" , "true" )
5753 . Execute ( )
5854 . Should ( )
5955 // if we did try to restore the esproj in this TestAsset we would fail, so passing means we didn't!
0 commit comments