Isaac Levin
Isaac Levin

Reputation: 2899

TFS Build with dotnet restore and 4.5 Project

I have a .Net CORE (Framework) Project that I want to build and deploy using TFS. I do a Nuget Restore Task first on the solution and than run MSBuild Solution with the following argument

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\" (Visual Studio Version 2015)

I get the Please run "dotnet restore" to generate a new lock file. message but I cannot run that because there is a library that is referenced that is 4.5 and the dotnet cli errors on that project. Is there a workaround for this?

Upvotes: 1

Views: 1294

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51073

No workaround for this situation, you have to run dotnet restore.

This behavior is by design. […] If you wish to restore all of the dependencies for all your projects in one go, so to speak, just run dotnet restore at the root of your solution (where you have the global.json file).

From Zlatko Knezevic:

As for your "mixed" solution with 4.5, it's not support by ASP.NET Core 1.0 with msbuild. enter image description here

You could also take a look at this simialr issue in GITHub: dotnet restore unable to resolve .NET Framework libraries (4.5.2)

Upvotes: 1

Related Questions