Build C# standard project with the latest versions of the nuget references

When using new C# projects we don't have packages.config files. The dependencies are specified inside the *.proj file, something like:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="XYZ.Definitions" Version="1.0.0-CI-20181010-102209" />
    <PackageReference Include="XYZ.Definitions.Common" Version="1.0.0-CI-20181010-102209" />
  </ItemGroup>
</Project>

How can I specify that I always want to build with the latest versions available of my references?

I was thinking something like:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <LangVersion>latest</LangVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="XYZ.Definitions" Version="latest" />
    <PackageReference Include="XYZ.Definitions.Common" Version="latest" />
  </ItemGroup>
</Project>

I dont know if this is even possible. Also here you can find a solution but in another context, that is using packages.config and nuget.config files.

Upvotes: 0

Views: 79

Answers (1)

henrik
henrik

Reputation: 314

* will use the latest stable version available.

Solution:

<PackageReference Include="XYZ.Definitions" Version="*" />

Upvotes: 1

Related Questions