Bug 59663 - Adding NuGet package (System.Security.Cryptography.Algoritms) does not add reference to project
Summary: Adding NuGet package (System.Security.Cryptography.Algoritms) does not add re...
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 11.0 (xcode9)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2017-09-21 17:54 UTC by Franklin Munoz
Modified: 2017-09-26 17:43 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

Sample repro solution (813.74 KB, application/zip)
2017-09-21 17:54 UTC, Franklin Munoz

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 59663 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Franklin Munoz 2017-09-21 17:54:14 UTC
Created attachment 24859 [details]
Sample repro solution

On a brand new project (Xamarin iOS Single View App), adding a package to the project via the UI does not add a reference to the assembly in the package and there is no way to add the reference unless you browse the file system and add the assembly directly.

Repro steps:

1- Launch VS for Mac
2- Click on new project, select "iOS single view app"
3- add a name and complete the wizard
4- expand the solution explorer and right click on "Packages" and select "Add Package"
5- Search for System.Security.Cryptography.Algorithms and add the package version 4.3.0, accept the license agreement dialog.
6- edit any cs source file and add the following to a function (i.e. main.cs inside Main())

System.Security.Cryptography.IncrementalHash h = null;

7- Build
Application compiles correctly

Build error:
Main.cs(10,42,10,57): error CS0234: The type or namespace name 'IncrementalHash' does not exist in the namespace 'System.Security.Cryptography' (are you missing an assembly reference?)
    0 Warning(s)
    1 Error(s)

Adding other nuget packages result in added references and correct builds, we have only identified this issue with this particular nuget.
Comment 1 Matt Ward 2017-09-21 19:04:34 UTC
This seems to be the correct behaviour based on the System.Security.Cryptography 4.3.0 NuGet package. The lib folder in the NuGet package has an empty xamarinios10 folder so no references will be added. There are also no dependencies:

<group targetFramework="Xamarin.iOS1.0" />

Looking at this NuGet package it looks like it is assumed that Xamarin.iOS will provide the types for this itself and the NuGet package basically does nothing.

If you add a reference to System.Security using the Edit References dialog then that adds the namespace but IncrementalHash is missing.

So either this is a NuGet package problem or a type is missing from Xamarin.iOS.
Comment 2 Marek Safar 2017-09-25 22:53:16 UTC
The type is not missing, it's available in XI version of System.Security.Cryptography.Algorithm.dll located in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//Facades/

However, I am not sure if this is nuget or msbuild issue because the facade is not used anywhere in the build, probably because it's transparent and therefore csc has no knowledge of the type
Comment 3 Jeffrey Stedfast 2017-09-26 16:31:24 UTC
I'm not sure this bug belongs in Xamarin.iOS/MSBuild because it really has nothing to do with our targets.
Comment 4 Ankit Jain 2017-09-26 17:04:19 UTC
I tried building the project and noticed this error too:


It could just be due to XI being too old (

The facades get expanded if there is any reference depending on `System.Runtime`. If the template project does not have such a reference and the nuget isn't adding anything either, then that might be the reason why facades are not being expanded.