1
+ // Copyright (c) .NET Foundation. All rights reserved.
2
+ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
+
1
4
using System ;
2
- using System . Collections . Generic ;
3
5
using System . IO ;
4
- using System . Linq ;
5
6
using System . Net ;
6
- using System . Threading ;
7
7
using System . Threading . Tasks ;
8
- using System . Xml . Linq ;
9
8
using Microsoft . AspNetCore . Server . IntegrationTesting ;
9
+ using Microsoft . Extensions . CommandLineUtils ;
10
10
using Microsoft . Extensions . Logging ;
11
11
using Microsoft . Extensions . Logging . Testing ;
12
12
using Xunit ;
13
13
using Xunit . Abstractions ;
14
14
using Xunit . Sdk ;
15
15
16
-
17
16
namespace Microsoft . AspNetCore . Server . IISIntegration . FunctionalTests
18
17
{
19
18
public class StartupTests : LoggedTest
@@ -26,16 +25,20 @@ public StartupTests(ITestOutputHelper output) : base(output)
26
25
[ Fact ]
27
26
public async Task ExpandEnvironmentVariableInWebConfig ( )
28
27
{
29
- var architecture = RuntimeArchitecture . x64 ;
30
- var dotnetLocation = $ "%USERPROFILE%\\ .dotnet\\ { architecture . ToString ( ) } \\ dotnet.exe";
28
+ #if NET461
29
+ // use the dotnet on PATH
30
+ var dotnetLocation = "dotnet" ;
31
+ #else
32
+ var dotnetLocation = DotNetMuxer . MuxerPathOrDefault ( ) ;
33
+ #endif
31
34
using ( StartLog ( out var loggerFactory ) )
32
35
{
33
36
var logger = loggerFactory . CreateLogger ( "HelloWorldTest" ) ;
34
37
35
38
var deploymentParameters = GetBaseDeploymentParameters ( ) ;
36
39
37
40
// Point to dotnet installed in user profile.
38
- deploymentParameters . EnvironmentVariables [ "DotnetPath" ] = Environment . ExpandEnvironmentVariables ( dotnetLocation ) ; // Path to dotnet.
41
+ deploymentParameters . EnvironmentVariables [ "DotnetPath" ] = dotnetLocation ;
39
42
40
43
using ( var deployer = ApplicationDeployerFactory . Create ( deploymentParameters , loggerFactory ) )
41
44
{
@@ -72,7 +75,7 @@ public async Task InvalidProcessPath_ExpectServerError()
72
75
{
73
76
var logger = loggerFactory . CreateLogger ( "HelloWorldTest" ) ;
74
77
var deploymentParameters = GetBaseDeploymentParameters ( ) ;
75
-
78
+
76
79
// Point to dotnet installed in user profile.
77
80
deploymentParameters . EnvironmentVariables [ "DotnetPath" ] = Environment . ExpandEnvironmentVariables ( dotnetLocation ) ; // Path to dotnet.
78
81
@@ -101,7 +104,7 @@ public async Task StandaloneApplication_ExpectCorrectPublish()
101
104
using ( StartLog ( out var loggerFactory ) )
102
105
{
103
106
var logger = loggerFactory . CreateLogger ( "HelloWorldTest" ) ;
104
-
107
+
105
108
var deploymentParameters = GetBaseDeploymentParameters ( ) ;
106
109
107
110
using ( var deployer = ApplicationDeployerFactory . Create ( deploymentParameters , loggerFactory ) )
@@ -171,7 +174,7 @@ public async Task StandaloneApplication_AbsolutePathToExe_ExpectCorrectPublish()
171
174
#else
172
175
#error Target frameworks need to be updated
173
176
#endif
174
-
177
+
175
178
[ Fact ]
176
179
public async Task DetectsOveriddenServer ( )
177
180
{
0 commit comments