@@ -272,7 +272,7 @@ stages:
272272 - ${{ if eq(parameters.RunStaticAnalysis, true) }} :
273273 - job :
274274 displayName : Run Static Analysis
275- timeoutInMinutes : 15
275+ timeoutInMinutes : 30
276276 pool :
277277 vmImage : windows-latest
278278 steps :
@@ -284,3 +284,62 @@ stages:
284284 displayName : Log Environment Variables
285285 - script : dotnet format whitespace --verify-no-changes NuGet.sln
286286 displayName : Run dotnet format whitespace
287+ condition : succeededOrFailed()
288+ - task : PowerShell@2
289+ displayName : Ensure all projects are in NuGet.sln
290+ condition : succeededOrFailed()
291+ inputs :
292+ targetType : inline
293+ script : |
294+ try {
295+ $slnProjects = & dotnet sln NuGet.sln list | Select-Object -Skip 2 | ForEach-Object { "$PWD\$_" } | sort
296+ "Solution contains $($slnProjects.Length) projects"
297+ $fsProjects = gci -Recurse -Filter *.csproj | ForEach-Object { $_.FullName } | Where-Object { $_ -notlike "*\EndToEnd\*" -and $_ -notlike "*\bin\*" -and $_ -notlike "*\compiler\resources\*" -and $_ -notlike "*\Assets\*" -and $_ -notlike "*\eng\*" } | sort
298+ "Repo contains $($fsProjects.Length) projects"
299+ $diff = @(Compare-Object -ReferenceObject $fsProjects -DifferenceObject $slnProjects)
300+ $diff
301+ if ($diff.length -gt 0)
302+ {
303+ throw "Repo has project file(s) not in NuGet.sln"
304+ }
305+ }
306+ catch
307+ {
308+ Write-Host "##vso[task.LogIssue type=error;]$Error[0]"
309+ exit 1
310+ }
311+
312+ - task : MSBuild@1
313+ displayName : Restore and Build
314+ condition : " and(succeededOrFailed(), ne(variables['SkipNupkgDependenciesCheck'], 'true'))"
315+ inputs :
316+ solution : NuGet.sln
317+ msbuildArchitecture : x64
318+ msbuildArguments : " /property:BuildRTM=true /property:MicroBuild_SigningEnabled=false"
319+
320+ - task : MSBuild@1
321+ displayName : Pack Nupkgs
322+ condition : " and(succeeded(), ne(variables['SkipNupkgDependenciesCheck'], 'true'))"
323+ inputs :
324+ solution : build\build.proj
325+ msbuildArchitecture : x64
326+ msbuildArguments : " /restore:false /target:Pack /property:BuildRTM=true /property:ExcludeTestProjects=true /property:MicroBuild_SigningEnabled=false"
327+
328+ - task : PowerShell@2
329+ displayName : Check package dependencies
330+ condition : " and(succeeded(), ne(variables['SkipNupkgDependenciesCheck'], 'true'))"
331+ inputs :
332+ targetType : inline
333+ script : |
334+ $nupkgs = Get-ChildItem artifacts/nupkgs/*.nupkg -Exclude *.symbols.nupkg,NuGet.CommandLine.XPlat.*
335+ if ($nupkgs.Count -eq 0) { throw "Could not find nupkgs" }
336+ "nupkgs:"
337+ $nupkgs.FullName
338+ ""
339+ "Building validation tool"
340+ dotnet build tools-local/ensure-nupkg-dependencies-on-source/
341+ if ($LASTEXITCODE -ne 0) { throw "Build was not successful" }
342+ ""
343+ "Running validation tool"
344+ dotnet run --project tools-local/ensure-nupkg-dependencies-on-source/ --no-build -- $nupkgs -s https://api.nuget.org/v3/index.json
345+ if ($LASTEXITCODE -ne 0) { throw "Validation tool failed" }
0 commit comments