Skip to content

Commit

Permalink
Move sln file to repo root
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Apr 10, 2020
1 parent 8441b31 commit 6065471
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
- name: build
run: dotnet build src --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog"
run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog"
- name: pack
run: dotnet pack src --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog"
run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog"
- name: test
run: dotnet test src --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings"
run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --logger trx --settings "${{ github.workspace }}/.github/workflows/${{ runner.os }}.runsettings"
- name: Update pipeline variables based on build outputs
run: azure-pipelines/variables/_pipelines.ps1
shell: pwsh
Expand Down
29 changes: 13 additions & 16 deletions Expand-Template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,27 @@ try {
}

# Rename project directories and solution
Set-Location src
git mv Library.sln "$LibraryName.sln"
git mv Library/Library.csproj "Library/$LibraryName.csproj"
git mv Library "$LibraryName"
git mv Library.Tests/Library.Tests.csproj "Library.Tests/$LibraryName.Tests.csproj"
git mv Library.Tests "$LibraryName.Tests"
git mv src/Library/Library.csproj "src/Library/$LibraryName.csproj"
git mv src/Library "src/$LibraryName"
git mv src/Library.Tests/Library.Tests.csproj "src/Library.Tests/$LibraryName.Tests.csproj"
git mv src/Library.Tests "src/$LibraryName.Tests"

# Refresh solution file both to update paths and give the projects unique GUIDs
dotnet sln remove Library/Library.csproj
dotnet sln remove Library.Tests/Library.Tests.csproj
dotnet sln add "$LibraryName"
dotnet sln add "$LibraryName.Tests"
dotnet sln remove src/Library/Library.csproj
dotnet sln remove src/Library.Tests/Library.Tests.csproj
dotnet sln add "src/$LibraryName"
dotnet sln add "src/$LibraryName.Tests"
git add "$LibraryName.sln"

# Update project reference in test project. Add before removal to keep the same ItemGroup in place.
dotnet add "$LibraryName.Tests" reference "$LibraryName"
dotnet remove "$LibraryName.Tests" reference Library/Library.csproj
git add "$LibraryName.Tests/$LibraryName.Tests.csproj"
dotnet add "src/$LibraryName.Tests" reference "src/$LibraryName"
dotnet remove "src/$LibraryName.Tests" reference src/Library/Library.csproj
git add "src/$LibraryName.Tests/$LibraryName.Tests.csproj"

# Establish a new strong-name key
& $sn.Path -k 2048 strongname.snk
git add strongname.snk

Set-Location ..
& $sn.Path -k 2048 src/strongname.snk
git add src/strongname.snk

# Replace placeholders in source files
Replace-Placeholders -Path "src/$LibraryName/Calculator.cs" -Replacements @{
Expand Down
22 changes: 11 additions & 11 deletions src/Library.sln → Library.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29322.22
MinimumVisualStudioVersion = 15.0.26124.0
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library", "src\Library\Library.csproj", "{C06D702E-6FC7-453B-BDDF-608F825EC003}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Library.Tests", "src\Library.Tests\Library.Tests.csproj", "{DC5F3D1C-A9A3-44B7-A3C0-82C1FF4C3336}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1CE9670B-D5FF-46A7-9D00-24E70E6ED48B}"
ProjectSection(SolutionItems) = preProject
..\.editorconfig = ..\.editorconfig
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
..\global.json = ..\global.json
..\nuget.config = ..\nuget.config
shipping.ruleset = shipping.ruleset
stylecop.json = stylecop.json
tests.ruleset = tests.ruleset
..\version.json = ..\version.json
.editorconfig = .editorconfig
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Build.targets = src\Directory.Build.targets
global.json = global.json
nuget.config = nuget.config
src\shipping.ruleset = src\shipping.ruleset
src\stylecop.json = src\stylecop.json
src\tests.ruleset = src\tests.ruleset
version.json = version.json
EndProjectSection
EndProject
Global
Expand Down
5 changes: 0 additions & 5 deletions azure-pipelines/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@ steps:

- script: dotnet build --no-restore -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/build.binlog"
displayName: dotnet build
workingDirectory: src

- script: dotnet pack --no-build -c $(BuildConfiguration) /v:m /bl:"$(Build.ArtifactStagingDirectory)/build_logs/pack.binlog"
displayName: dotnet pack
workingDirectory: src

- task: DotNetCoreCLI@2
displayName: dotnet test -f net472
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f net472 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
testRunTitle: net472-$(Agent.JobName)
workingDirectory: src
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

- task: DotNetCoreCLI@2
Expand All @@ -23,15 +20,13 @@ steps:
command: test
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp2.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
testRunTitle: netcoreapp2.1-$(Agent.JobName)
workingDirectory: src

- task: DotNetCoreCLI@2
displayName: dotnet test -f netcoreapp3.1
inputs:
command: test
arguments: --no-build -c $(BuildConfiguration) -f netcoreapp3.1 --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true --settings "$(Build.Repository.LocalPath)/azure-pipelines/$(Agent.OS).runsettings"
testRunTitle: netcoreapp3.1-$(Agent.JobName)
workingDirectory: src

- powershell: azure-pipelines/variables/_pipelines.ps1
failOnStderr: true
Expand Down
1 change: 0 additions & 1 deletion azure-pipelines/expand-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ steps:
failOnStderr: true
# TODO: Verify that all changes are staged to the git index
- script: dotnet build
workingDirectory: src
displayName: dotnet build (expanded template)
2 changes: 1 addition & 1 deletion init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ try {

if (!$NoRestore -and $PSCmdlet.ShouldProcess("NuGet packages", "Restore")) {
Write-Host "Restoring NuGet packages" -ForegroundColor $HeaderColor
dotnet restore src
dotnet restore
if ($lastexitcode -ne 0) {
throw "Failure while restoring packages."
}
Expand Down

0 comments on commit 6065471

Please sign in to comment.