Skip to content

Commit 72930b6

Browse files
Fixup project file
1 parent 59e9142 commit 72930b6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bin/add-practice-exercise.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,18 @@ $PSNativeCommandUseErrorActionPreference = $true
3131
# Create project
3232
$exerciseName = (Get-Culture).TextInfo.ToTitleCase($Exercise).Replace("-", "")
3333
$exerciseDir = "exercises/practice/${Exercise}"
34-
$project = "${exerciseDir}/${ExerciseName}.csproj"
35-
& dotnet new xunit --force -lang "C#" --target-framework-override net9.0 -o $exerciseDir -n $ExerciseName
34+
$projectFile = "${exerciseDir}/${ExerciseName}.csproj"
35+
& dotnet new install xunit.v3.templates
36+
& dotnet new xunit3 --force --output $exerciseDir --name $ExerciseName
37+
38+
[xml]$project = Get-Content $projectFile
39+
$project.Project.PropertyGroup.RemoveChild($project.Project.PropertyGroup.SelectSingleNode("//comment()"))
40+
$project.Project.RemoveChild($project.Project.ItemGroup[0])
41+
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='Microsoft.NET.Test.Sdk']").SetAttribute("Version", "17.12.0")
42+
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='xunit.v3']").SetAttribute("Version", "1.1.0")
43+
$project.Project.ItemGroup[1].SelectSingleNode("PackageReference[@Include='xunit.runner.visualstudio']").SetAttribute("Version", "3.0.2")
44+
$project.Save($projectFile)
45+
3646
& dotnet sln exercises/Exercises.sln add $project
3747

3848
# Update project packages

0 commit comments

Comments
 (0)