-
Notifications
You must be signed in to change notification settings - Fork 40
PackageReference management
Nate McMaster edited this page Oct 21, 2017
·
10 revisions
To manage the complexity of keeping PackageReference versions consistent within a repo and between multiple repos, KoreBuild will enforce the following patterns for using PackageReference.
Each repository should have this file, and it should look like this.
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup Label="Package Versions">
<NewtonsoftJsonPackageVersion>10.0.1</NewtonsoftJsonPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
<MoqPackageVersion>4.7.49</MoqPackageVersion>
<XunitPackageVersion>2.3.0</XunitPackageVersion>
</PropertyGroup>
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
</Project>
KoreBuild can help you automatically update the build/dependencies.props
file by using a lineup package.
You can set the following in your project to specify where your project will search for new versions.
<PropertyGroup>
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
<!-- Optional, and can float -->
<LineupPackageVersion>2.1.0-*</LineupPackageVersion>
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
</PropertyGroup>
All .csproj files should set the version of a package reference like this:
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
</ItemGroup>
To opt-out of these restrictions, projects should add this to the build/repo.props
file in their repository.
<PropertyGroup>
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
</PropertyGroup>