Skip to content

Commit 44461dc

Browse files
Migrate solution to SLNX (#1374)
* Migrate solution to SLNX Migrates the .NET solution to use the new [`.slnx`][slnx] file format. [slnx]: https://devblogs.microsoft.com/dotnet/introducing-slnx-support-dotnet-cli/ Contributes to martincostello/repo-migrations#85. Signed-off-by: costellobot[bot] <102247573+costellobot[bot]@users.noreply.github.com> * Migrate to SLNX Migrate to the new `.slnx` file format. --------- Signed-off-by: costellobot[bot] <102247573+costellobot[bot]@users.noreply.github.com> Co-authored-by: costellobot[bot] <102247573+costellobot[bot]@users.noreply.github.com> Co-authored-by: Martin Costello <[email protected]>
1 parent edb714f commit 44461dc

File tree

6 files changed

+50
-101
lines changed

6 files changed

+50
-101
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ indent_style = space
99
insert_final_newline = true
1010
trim_trailing_whitespace = true
1111

12-
[*.{config,csproj,json,props,ruleset,targets,yml}]
12+
[*.{config,csproj,json,props,ruleset,slnx,targets,yml}]
1313
indent_size = 2
1414

1515
# Code files

TodoApp.sln

Lines changed: 0 additions & 84 deletions
This file was deleted.

TodoApp.slnx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path=".editorconfig" />
4+
<File Path=".gitattributes" />
5+
<File Path=".gitignore" />
6+
<File Path=".vsconfig" />
7+
<File Path="build.ps1" />
8+
<File Path="CODE_OF_CONDUCT.md" />
9+
<File Path="Directory.Build.props" />
10+
<File Path="global.json" />
11+
<File Path="LICENSE" />
12+
<File Path="NuGet.config" />
13+
<File Path="README.md" />
14+
<File Path="TodoApp.ruleset" />
15+
</Folder>
16+
<Folder Name="/Solution Items/.github/">
17+
<File Path=".github/CONTRIBUTING.md" />
18+
<File Path=".github/dependabot.yml" />
19+
<File Path=".github/ISSUE_TEMPLATE.md" />
20+
<File Path=".github/PULL_REQUEST_TEMPLATE.md" />
21+
</Folder>
22+
<Folder Name="/Solution Items/.github/ISSUE_TEMPLATE/">
23+
<File Path=".github/ISSUE_TEMPLATE/bug_report.md" />
24+
</Folder>
25+
<Folder Name="/Solution Items/.github/workflows/">
26+
<File Path=".github/workflows/build.yml" />
27+
</Folder>
28+
<Folder Name="/Solution Items/.vscode/">
29+
<File Path=".vscode/extensions.json" />
30+
<File Path=".vscode/launch.json" />
31+
<File Path=".vscode/tasks.json" />
32+
</Folder>
33+
<Folder Name="/src/">
34+
<Project Path="src/TodoApp/TodoApp.csproj" />
35+
</Folder>
36+
<Folder Name="/tests/">
37+
<Project Path="tests/TodoApp.Tests/TodoApp.Tests.csproj" />
38+
</Folder>
39+
</Solution>

build.ps1

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if ($OutputPath -eq "") {
2828
$installDotNetSdk = $false;
2929

3030
if (($null -eq (Get-Command "dotnet" -ErrorAction SilentlyContinue)) -and ($null -eq (Get-Command "dotnet.exe" -ErrorAction SilentlyContinue))) {
31-
Write-Host "The .NET SDK is not installed."
31+
Write-Output "The .NET SDK is not installed."
3232
$installDotNetSdk = $true
3333
}
3434
else {
@@ -40,7 +40,7 @@ else {
4040
}
4141

4242
if ($installedDotNetVersion -ne $dotnetVersion) {
43-
Write-Host "The required version of the .NET SDK is not installed. Expected $dotnetVersion."
43+
Write-Output "The required version of the .NET SDK is not installed. Expected $dotnetVersion."
4444
$installDotNetSdk = $true
4545
}
4646
}
@@ -79,7 +79,7 @@ if ($installDotNetSdk -eq $true) {
7979
}
8080

8181
function DotNetTest {
82-
param([string]$Project)
82+
param()
8383

8484
$additionalArgs = @()
8585

@@ -88,7 +88,7 @@ function DotNetTest {
8888
$additionalArgs += "GitHubActions;report-warnings=false"
8989
}
9090

91-
& $dotnet test $Project --output $OutputPath --configuration $Configuration $additionalArgs
91+
& $dotnet test --output $OutputPath --configuration $Configuration $additionalArgs
9292

9393
if ($LASTEXITCODE -ne 0) {
9494
throw "dotnet test failed with exit code $LASTEXITCODE"
@@ -106,23 +106,17 @@ function DotNetPublish {
106106
}
107107
}
108108

109-
$testProjects = @(
110-
(Join-Path $solutionPath "tests" "TodoApp.Tests" "TodoApp.Tests.csproj")
111-
)
112-
113109
$publishProjects = @(
114110
(Join-Path $solutionPath "src" "TodoApp" "TodoApp.csproj")
115111
)
116112

117-
Write-Host "Publishing solution..." -ForegroundColor Green
113+
Write-Output "Publishing solution..."
118114
ForEach ($project in $publishProjects) {
119115
DotNetPublish $project $Configuration
120116
}
121117

122-
if ($SkipTests -eq $false) {
123-
Write-Host "Testing $($testProjects.Count) project(s)..." -ForegroundColor Green
124-
ForEach ($project in $testProjects) {
125-
DotNetTest $project
126-
}
118+
if (-Not $SkipTests) {
119+
Write-Output "Testing solution..."
120+
DotNetTest
127121
}
128122

startvs.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SET DOTNET_ROOT(x86)=%~dp0.dotnetcli\x86
1010
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use.
1111
SET PATH=%DOTNET_ROOT%;%PATH%
1212

13-
SET sln=%~dp0TodoApp.sln
13+
SET sln=%~dp0TodoApp.slnx
1414

1515
IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
1616
echo The .NET SDK has not yet been installed. Run `%~dp0build.ps1` to install it

tests/TodoApp.Tests/TodoAppFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected override void ConfigureWebHost(IWebHostBuilder builder)
6969
builder.ConfigureLogging(loggingBuilder => loggingBuilder.ClearProviders().AddXUnit(this));
7070

7171
// Configure the correct content root for the static content and Razor pages
72-
builder.UseSolutionRelativeContentRoot(Path.Combine("src", "TodoApp"));
72+
builder.UseSolutionRelativeContentRoot(Path.Combine("src", "TodoApp"), "*.slnx");
7373

7474
// Configure the application so HTTP requests related to the OAuth flow
7575
// can be intercepted and redirected to not use the real GitHub service.

0 commit comments

Comments
 (0)