Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
set -e
echo "Finding SDK-style projects..."
mapfile -t sdk_projects < <(grep -rl --null --exclude-dir:packages '<Project Sdk=' --include='*.csproj' . | tr '\0' '\n' || true)
mapfile -t sdk_projects < <(grep -rl --null --exclude-dir=packages '<Project Sdk=' --include='*.csproj' . | tr '\0' '\n' || true)
if [ ${#sdk_projects[@]} -eq 0 ]; then
echo "No SDK-style projects found. Skipping SDK job."
exit 0
Expand All @@ -70,7 +70,7 @@ jobs:
run: |
set -e
# Run dotnet test on projects that look like test projects
mapfile -t sdk_projects < <(grep -rl --null --exclude-dir:packages '<Project Sdk=' --include='*.csproj' . | tr '\0' '\n' || true)
mapfile -t sdk_projects < <(grep -rl --null --exclude-dir=packages '<Project Sdk=' --include='*.csproj' . | tr '\0' '\n' || true)
for proj in "${sdk_projects[@]}"; do
if grep -q '<IsTestProject>true</IsTestProject>' "$proj" 2>/dev/null || echo "$proj" | grep -qi 'test'; then
echo "Testing $proj"
Expand Down Expand Up @@ -99,19 +99,26 @@ jobs:
- name: Setup NuGet CLI
uses: NuGet/setup-nuget@v1

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Restore packages.config packages (NuGet)
run: |
nuget restore
$ErrorActionPreference = 'Stop'
$sln = (Get-ChildItem -Path . -Filter *.sln -Recurse | Select-Object -First 1).FullName
if (-not $sln) { throw "No solution file found." }
nuget restore $sln -PackagesDirectory .\packages -NonInteractive

- name: Restore & build all projects (including legacy)
- name: Build legacy non-SDK projects with MSBuild
run: |
$ErrorActionPreference = 'Stop'
$csprojs = Get-ChildItem -Recurse -Filter *.csproj | Select-Object -ExpandProperty FullName
foreach ($p in $csprojs) {
Write-Host "Restoring $p"
dotnet restore $p -p:Configuration=Release
Write-Host "Building $p"
dotnet build $p -c Release --no-restore
$legacyProjects = Get-ChildItem -Recurse -Filter *.csproj | Where-Object {
-not (Select-String -Path $_.FullName -Pattern '<Project Sdk=' -Quiet)
} | Select-Object -ExpandProperty FullName

foreach ($p in $legacyProjects) {
Write-Host "Building legacy project $p"
msbuild $p /m /p:Configuration=Release /p:RestorePackages=false
}

- name: Run tests (legacy/test projects)
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ jobs:
nuget-version: latest
nuget-api-key-source: 'https://api.nuget.org/v3/index.json'

- name: Restore
- name: Restore packages.config dependencies
run: |
$sln = (Get-ChildItem -Path . -Filter *.sln -Recurse | Select-Object -First 1).FullName
if (-not $sln) { throw "No solution file found." }
nuget restore $sln -PackagesDirectory .\packages -NonInteractive

- name: Restore SDK-style dependencies
run: dotnet restore -p:Configuration=Release

- name: Build
Expand Down
4 changes: 2 additions & 2 deletions examples/UsageExample3/UsageExample3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<HintPath>..\..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.WebRequest">
Expand Down
Loading