Skip to content

Commit

Permalink
Onboard to NuGet central package management (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl authored Mar 13, 2023
1 parent 0bba61d commit fa23053
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 17 deletions.
2 changes: 0 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<Project>
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />

<PropertyGroup>
<MicroBuild_NuPkgSigningEnabled Condition="'$(SignType)' == 'Test'">false</MicroBuild_NuPkgSigningEnabled>
<NoWarn Condition="'$(IsTestProject)' == 'true'">$(NoWarn);SA1600</NoWarn>
Expand Down
24 changes: 12 additions & 12 deletions Packages.props → Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MicrosoftBuildPackageVersion>17.5.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'netcoreapp3.1'">16.9.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'netstandard2.0'">16.9.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net46'">15.9.20</MicrosoftBuildPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageReference Update="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Update="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Update="MSBuild.ProjectCreation" Version="8.3.0" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Update="Shouldly" Version="4.1.0" />
<PackageReference Update="xunit" Version="2.4.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Update="CopyOnWrite" Version="0.3.2" />
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildPackageVersion)" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageVersion Include="MSBuild.ProjectCreation" Version="9.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Shouldly" Version="4.1.0" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="CopyOnWrite" Version="0.3.2" />
</ItemGroup>

<ItemGroup>
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="4.2.0" Condition="'$(EnableArtifacts)' != 'false'" />
<GlobalPackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="1.0.0" Condition="'$(EnableMicroBuild)' != 'false'" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.113" Condition="'$(EnableGitVersioning)' != 'false'" />
<GlobalPackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<GlobalPackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" Condition="'$(EnableGitVersioning)' != 'false'" />
</ItemGroup>

<ItemGroup Condition=" '$(EnableStyleCop)' != 'false' ">
Expand Down
2 changes: 1 addition & 1 deletion MSBuildSdks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{DC479DC1
Directory.Build.props = Directory.Build.props
Directory.Build.rsp = Directory.Build.rsp
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
global.json = global.json
LICENSE.txt = LICENSE.txt
NuGet.config = NuGet.config
Packages.props = Packages.props
README.md = README.md
RELEASE.md = RELEASE.md
stylecop.json = stylecop.json
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variables:
ArtifactsDirectoryName: 'artifacts'
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
DotNetVersion: '6.x'
DotNetVersion: '7.x'
MSBuildArgs: '"/p:Platform=$(BuildPlatform)" "/p:Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
SignType: 'Test'

Expand Down
18 changes: 17 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ variables:
BuildConfiguration: 'Debug'
BuildPlatform: 'Any CPU'
DotNet3Version: '3.x'
DotNet6Version: '6.0.203'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
MSBuildArgs: '"/p:Platform=$(BuildPlatform)" "/p:Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
SignType: 'Test'

Expand Down Expand Up @@ -45,6 +46,11 @@ jobs:
inputs:
version: '$(DotNet6Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet7Version)'
inputs:
version: '$(DotNet7Version)'

- task: DotNetCoreCLI@2
displayName: 'Build Solution'
inputs:
Expand Down Expand Up @@ -93,6 +99,11 @@ jobs:
inputs:
version: '$(DotNet6Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet7Version)'
inputs:
version: '$(DotNet7Version)'

- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
Expand Down Expand Up @@ -125,6 +136,11 @@ jobs:
inputs:
version: '$(DotNet6Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet7Version)'
inputs:
version: '$(DotNet7Version)'

- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
Expand Down
6 changes: 6 additions & 0 deletions samples/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<!-- Disable NuGet central package management -->
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>

0 comments on commit fa23053

Please sign in to comment.