MsBuild failing for .Net Standard project with error "Package System.Security.Cryptography.ProtectedData, version x.x.x was not found"
Asked Answered
C

0

6

Project Setup : Mixed framework solution

  1. .Net Framework 4.6.2 projects in solution : 15
  2. .Net Standard 2.0 projects in solution - 1

Development Machine

  1. Visual Studio 2017(15.7.4) : Builds without any errors

Build Server

  1. TeamCity Version 2017.1.3
  2. Build Steps
    • Nuget Restore(3.4.4)
    • dotnet Restore
    • MSBuild( Build Tools 2017), Tools Version 15.0

Build fails with following error in the .net standard 2.0 project : [ResolvePackageAssets] C:\Program Files\dotnet\sdk\2.1.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198, 5): Package System.Security.Cryptography.ProtectedData, version 4.4.0 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.

What's interesting is I can't find reference or use of System.Security.Cryptography.ProtectedData anywhere in the project. Any help is greatly appreciated.

P.S - Can't use dotnet build, as the solution needs building of licenses.licx files, and the component which builds it (Microsoft.Build.Tasks.LC) is not ported to .Net Core. The suggestion from various posts was to use MsBuild.exe

Cruise answered 10/7, 2018 at 15:8 Comment(3)
I assume that package is pulled in by the SDK. Can you get a build log from the msbuild.exe command on the server? That might shed some light to why the package is believed to be missing.Culottes
I have similar error with MSBuild Tools 2019 or 2022 and TeamCity 2022.04, with the simple NET Standard Project and not found 'System' library.Renaldo
TeamCity is the problem, because when I use MSBuild comand: msbuild helloworld.csproj /t:Build /verbosity:detailed in CMD Developer Command Prompt for VS is succesfull.Renaldo

© 2022 - 2024 — McMap. All rights reserved.