Sdk: dotnet restore with update in the new csproj/msbuild-based core projects?

Created on 22 Jan 2017  路  3Comments  路  Source: dotnet/sdk

How do I actually update the new csproj-based project's Nuget packages to the latest ones when using Visual Studio Code?

This is what I have within the .csproj file:

<PackageReference Include="Microsoft.AspNetCore" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.0" />

If I do dotnet restore it will only install the specified package versions.

There is no dotnet restore update or dotnet nuget update option available.

All of the above referenced Microsoft.AspNetCore.* packages have newer versions (1.1.0).

I would like to update the packages and have the references updated automatically in the same way we do this in Visual Studio.

Most helpful comment

This is quite unfortunate since not only we can't update automatically we also have to manually check if (and which) packages have new versions available on the NuGet feed and manually write them down. I don't see this feasible at all with anything more than a few packages referenced.

I thought I could use nuget.exe as a workaround but it doesn't support the new .csproj files yet so basically we're stuck.

All 3 comments

@brgrz for now, you do it manually by changing the version in the Version attribute. This is not ideal and we are working on an dotnet update package command that will help you do this, however we will most likely not be able to get it in for 1.0.0.

Leaving this issue for 2.0.0 to track that.

This is quite unfortunate since not only we can't update automatically we also have to manually check if (and which) packages have new versions available on the NuGet feed and manually write them down. I don't see this feasible at all with anything more than a few packages referenced.

I thought I could use nuget.exe as a workaround but it doesn't support the new .csproj files yet so basically we're stuck.

I'm movint this issue to nuget/home as well. The nuget capabilities in the CLI are just thin wrappers around the NuGet x-plat client dll, so enabling this behavior will actually be work in that repo as well!

Was this page helpful?
0 / 5 - 0 ratings