Skip to content

Commit 57db593

Browse files
committed
Fixup test
1 parent ad8a927 commit 57db593

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/ProjectTemplates/Shared/AspNetProcess.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public AspNetProcess(
4242
IDictionary<string, string> environmentVariables,
4343
bool published,
4444
bool hasListeningUri = true,
45+
bool usePublishedAppHost = false,
4546
ILogger logger = null)
4647
{
4748
_developmentCertificate = DevelopmentCertificate.Create(workingDirectory);
@@ -64,9 +65,17 @@ public AspNetProcess(
6465
string arguments;
6566
if (published)
6667
{
67-
// When publishingu used the app host to run the app. This makes it easy to consistently run for regular and single-file publish
68-
process = OperatingSystem.IsWindows() ? dllPath + ".exe" : dllPath;
69-
arguments = null;
68+
if (usePublishedAppHost)
69+
{
70+
// When publishingu used the app host to run the app. This makes it easy to consistently run for regular and single-file publish
71+
process = Path.ChangeExtension(dllPath, OperatingSystem.IsWindows() ? ".exe" : null);
72+
arguments = null;
73+
}
74+
else
75+
{
76+
process = DotNetMuxer.MuxerPathOrDefault();
77+
arguments = $"exec {dllPath}";
78+
}
7079
}
7180
else
7281
{

src/ProjectTemplates/Shared/Project.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ internal AspNetProcess StartBuiltProjectAsync(bool hasListeningUri = true, ILogg
179179
return new AspNetProcess(Output, TemplateOutputDir, projectDll, environment, published: false, hasListeningUri: hasListeningUri, logger: logger);
180180
}
181181

182-
internal AspNetProcess StartPublishedProjectAsync(bool hasListeningUri = true)
182+
internal AspNetProcess StartPublishedProjectAsync(bool hasListeningUri = true, bool usePublishedAppHost = false)
183183
{
184184
var environment = new Dictionary<string, string>
185185
{
@@ -190,8 +190,8 @@ internal AspNetProcess StartPublishedProjectAsync(bool hasListeningUri = true)
190190
["ASPNETCORE_Logging__Console__FormatterOptions__IncludeScopes"] = "true",
191191
};
192192

193-
var projectDll = Path.Combine(TemplatePublishDir, ProjectName);
194-
return new AspNetProcess(Output, TemplatePublishDir, projectDll, environment, published: true, hasListeningUri: hasListeningUri);
193+
var projectDll = Path.Combine(TemplatePublishDir, $"{ProjectName}.dll");
194+
return new AspNetProcess(Output, TemplatePublishDir, projectDll, environment, published: true, hasListeningUri: hasListeningUri, usePublishedAppHost: usePublishedAppHost);
195195
}
196196

197197
internal async Task<ProcessResult> RunDotNetEfCreateMigrationAsync(string migrationName)

src/ProjectTemplates/test/MvcTemplateTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public async Task MvcTemplate_SingleFileExe()
243243
return;
244244
}
245245

246-
Project = await ProjectFactory.GetOrCreateProject("mvcindividualuld", Output);
246+
Project = await ProjectFactory.GetOrCreateProject("mvcsinglefileexe", Output);
247247
Project.RuntimeIdentifier = runtimeIdentifer;
248248

249249
var createResult = await Project.RunDotNetNewAsync("mvc", auth: "Individual", useLocalDB: true);
@@ -286,7 +286,7 @@ public async Task MvcTemplate_SingleFileExe()
286286
},
287287
};
288288

289-
using var aspNetProcess = Project.StartPublishedProjectAsync();
289+
using var aspNetProcess = Project.StartPublishedProjectAsync(usePublishedAppHost: true);
290290
Assert.False(
291291
aspNetProcess.Process.HasExited,
292292
ErrorMessages.GetFailedProcessMessageOrEmpty("Run published project", Project, aspNetProcess.Process));

0 commit comments

Comments
 (0)