1
votes

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?

1
Which build are you using XAML or Vnext ? And what's your TFS version? - PatrickLu-MSFT
Visual Studio 2015, XAML and VSO hosted - Isaac Levin
@Patrick-MSFT see above - Isaac Levin

1 Answers

1
votes

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)