Skip to content

Commit 60abfaf

Browse files
authored
Re-enable SingleFileExe (#39977)
* Re-enable SingleFileExe Fixes #25103 Updates the test to * run on Windows-only to avoid the need to have the runtime available * avoids using IdentityUI since that package doesn't work with this very well (Identity UI splits views in to a separate assembly).
1 parent ce292b3 commit 60abfaf

File tree

1 file changed

+36
-66
lines changed

1 file changed

+36
-66
lines changed

src/ProjectTemplates/test/MvcTemplateTest.cs

Lines changed: 36 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
5-
using System.Collections.Generic;
6-
using System.IO;
7-
using System.Linq;
8-
using System.Threading.Tasks;
94
using Microsoft.AspNetCore.Testing;
105
using Templates.Test.Helpers;
11-
using Xunit;
126
using Xunit.Abstractions;
13-
using Xunit.Sdk;
147

158
namespace Templates.Test;
169

@@ -83,18 +76,18 @@ private async Task MvcTemplateCore(string languageOverride)
8376
var footerLinks = new string[] { PageUrls.PrivacyFullUrl };
8477

8578
var pages = new List<Page>
79+
{
80+
new Page
8681
{
87-
new Page
88-
{
89-
Url = PageUrls.HomeUrl,
90-
Links = menuLinks.Append(PageUrls.DocsUrl).Concat(footerLinks)
91-
},
92-
new Page
93-
{
94-
Url = PageUrls.PrivacyFullUrl,
95-
Links = menuLinks.Concat(footerLinks)
96-
}
97-
};
82+
Url = PageUrls.HomeUrl,
83+
Links = menuLinks.Append(PageUrls.DocsUrl).Concat(footerLinks)
84+
},
85+
new Page
86+
{
87+
Url = PageUrls.PrivacyFullUrl,
88+
Links = menuLinks.Concat(footerLinks)
89+
}
90+
};
9891

9992
using (var aspNetProcess = project.StartBuiltProjectAsync())
10093
{
@@ -234,68 +227,45 @@ public async Task MvcTemplate_IndividualAuth(bool useLocalDB)
234227
}
235228
}
236229

237-
[ConditionalFact(Skip = "https://github.com/dotnet/aspnetcore/issues/25103")]
230+
[ConditionalFact]
231+
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] // Running these requires the rid-specific runtime pack to be available which is not consistent in all our platform builds.
238232
[SkipOnHelix("cert failure", Queues = "All.OSX")]
239233
public async Task MvcTemplate_SingleFileExe()
240234
{
241235
// This test verifies publishing an MVC app as a single file exe works. We'll limit testing
242236
// this to a few operating systems to make our lives easier.
243-
string runtimeIdentifer;
244-
if (OperatingSystem.IsWindows())
245-
{
246-
runtimeIdentifer = "win-x64";
247-
}
248-
else if (OperatingSystem.IsLinux())
249-
{
250-
runtimeIdentifer = "linux-x64";
251-
}
252-
else
253-
{
254-
return;
255-
}
256-
237+
var runtimeIdentifer = "win-x64";
257238
var project = await ProjectFactory.GetOrCreateProject("mvcsinglefileexe", Output);
258239
project.RuntimeIdentifier = runtimeIdentifer;
259240

260-
var createResult = await project.RunDotNetNewAsync("mvc", auth: "Individual", useLocalDB: true);
241+
var createResult = await project.RunDotNetNewAsync("mvc");
261242
Assert.True(0 == createResult.ExitCode, ErrorMessages.GetFailedProcessMessage("create/restore", project, createResult));
262243

263244
var publishResult = await project.RunDotNetPublishAsync(additionalArgs: $"/p:PublishSingleFile=true -r {runtimeIdentifer}", noRestore: false);
264245
Assert.True(0 == publishResult.ExitCode, ErrorMessages.GetFailedProcessMessage("publish", project, publishResult));
265246

266-
var pages = new[]
247+
var menuLinks = new[]
267248
{
268-
new Page
269-
{
270-
// Verify a view from the app works
271-
Url = PageUrls.HomeUrl,
272-
Links = new []
273-
{
274-
PageUrls.HomeUrl,
275-
PageUrls.RegisterUrl,
276-
PageUrls.LoginUrl,
277-
PageUrls.HomeUrl,
278-
PageUrls.PrivacyUrl,
279-
PageUrls.DocsUrl,
280-
PageUrls.PrivacyUrl
281-
}
282-
},
283-
new Page
284-
{
285-
// Verify a view from a RCL (in this case IdentityUI) works
286-
Url = PageUrls.RegisterUrl,
287-
Links = new []
288-
{
289-
PageUrls.HomeUrl,
290-
PageUrls.RegisterUrl,
291-
PageUrls.LoginUrl,
292-
PageUrls.HomeUrl,
293-
PageUrls.PrivacyUrl,
294-
PageUrls.ExternalArticle,
295-
PageUrls.PrivacyUrl
296-
}
297-
},
298-
};
249+
PageUrls.HomeUrl,
250+
PageUrls.HomeUrl,
251+
PageUrls.PrivacyFullUrl
252+
};
253+
254+
var footerLinks = new[] { PageUrls.PrivacyFullUrl };
255+
256+
var pages = new List<Page>
257+
{
258+
new Page
259+
{
260+
Url = PageUrls.HomeUrl,
261+
Links = menuLinks.Append(PageUrls.DocsUrl).Concat(footerLinks),
262+
},
263+
new Page
264+
{
265+
Url = PageUrls.PrivacyFullUrl,
266+
Links = menuLinks.Concat(footerLinks),
267+
}
268+
};
299269

300270
using var aspNetProcess = project.StartPublishedProjectAsync(usePublishedAppHost: true);
301271
Assert.False(

0 commit comments

Comments
 (0)