Missing System.Security.Cryptography - portable-class-library

I want to use the HMACSHA1 class in a project but the namespace System.Security.Cryptography is missing. If I add the reference System.Security, I find the namespace Cryptography but without the class HMACSHA1. And I can't find the namespace Windows.Security.Cryptography which seems to replace System.Security.Cryptography.
My projet targets the framework .NET 4.5and the .NET for Windows Store apps and He use Nuget on Visual 2012 on Windows 7.
Someone have a solution to this problem ?

According to the MSDN entry on HMACSHA1
There's no information that it is included in the Portable Class Library.
BUT: there's Portable Class Libraries Contrib out there, which includes a port of HMACSHA1

I had what sounds like a similar problem in a newly created C# console application. By default System reference showed some of System.Security, but not any of the Cryptography stuff. I had to right click 'References', 'Add Reference' and select 'System Security' after which I had access to the Cryptography stuff.
I'm fairly new to C# so sorry if my description isn't up to snuff or if this solution doesn't apply to mobile apps. Maybe helps someone else. thx

Related

F# NetStandard 2 Sytem.Net.Http name space missing

I am new to F# and I apologize if this question was asked before, but I could not find it.
I am trying to create an F# DLL in NetStandard 2.0 and I would like to use HttpClient
open System.Net.Http does not work: The namespace 'Net' is not defined.
I looked and could not find any solutions specific to F# and HttpClient in the context of NetStandard 2.0
The name space System.Net.Http is there on the C# side using in NetStandard 2.0. No problem there.
On F#, intellisense does not show the .Http namespace when expanding System.Net
Any ideas would be greatly appreciated.
TIA,
David
That namespace is an assembly that is not automatically referenced as part of .NET, so it needs to be referenced for each project that uses it. It's possible that the C# project already had the reference, or your tooling added it automatically when you tried to open the namespace. So you just need to add a reference to the DLL "System.Net.Http" in your F# project.

Metro app references and types in Windows 8

I developing C#\XAML metro-ui application. I need some .NET types that doesn't included in .NET for Metro style apps or Windows references (for instance HttpUtility that is located in System.Web). I can't find System.Web via Assembly List. In same time I can refer it via Browse. But as I understand correct isn't it good way and I should avoid this, is it?
Next thing I have found description of Assembly Class. In the bottom of page in Version Information section I can see that it is supported by Portable Class Library. In the sample I see next code
Assembly assem = Assembly.GetExecutingAssembly();
But in my project Assembly doesn't have GetExecutingAssembly method. Is it documentation outdated? or I miss something?
I use Windows 8 Release Candidate and VS 2012
EDIT0: Instead of HttpUtility I should use WebUtility I know it. But I choose this type just for example.
EDIT1: I see public static System.Reflection.Assembly GetExecutingAssembly() via Object Browser but can't reach it.
Metro style apps can only call methods in the .NET Core Profile. You can see the Core Profile reference assemblies on Windows 8 RP machine at ...
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5
You can use ILDasm or ILSpy to view them. See A .NET developer's view of Windows 8 app development video from Build. He talks more about the Core Profile and why some classes, methods and interfaces were removed.

Is there a portable class library profile which supports System.Xml.Linq and System.Windows for .NET 4.0

I've been working with the Portable Class Libaries using the Visual Studio 11 Beta release.
I've had quite a lot of success getting WP7, Silverlight and .Net 4.5 working together within "Profile104".
However, I've not found a way to get .Net 4 supported within the same or similar profile. In particular, I'm looking for a profile where System.Xml.Linq and System.Windows.Input.ICommand are available?
Is there any way to do this? Either by using a standard profile, or by creating my own profile and then adding type forwarding?
Thanks
Stuart
No, ICommand (as well as INotifyCollectionChanged and ObservableCollection) is not available in a portable library that targets a version of .NET before 4.0. We had to make some changes in .NET to support it (mainly adding System.Windows.dll with type forwards), which aren't available on earlier versions.
I believe System.Xml.Linq is available for portable libraries on .NET 4.0.3 and above.

Does referencing the JDK namespaces from within a .NET application require the Java runtime to be installed?

I'm in a VB.NET application. I have referenced some java.* namespaces in my file and am utilizing objects and methods from this namespace throughout the code. Presumably this is relying upon J# to compile.
Imports java.util
Imports java.util.zip
Imports java.io
Are these JDK namespaces fully contained in the .NET framework, or will my clients need to have Java installed when they go to run my application?
As a side note, I have not explicity referenced any external Java DLL's or anything. This is all pure .NET as far as my code is concerned.
Yes, they're within the J# DLLs, which I strongly suspect VB is referencing for you automatically. If you open your binaries up in Reflector, I'm sure you'll see a reference to vjslib.dll there.
There's no dependency on an actual JRE/JDK being installed.
Personally I would try to migrate away from them, however. If you need more compression options than System.IO.Compression it's worth looking at SharpZipLib. Microsoft no longer ships J# as a product, and the idea of trying to port all the Java 1.1.4 classes to .NET, including their quirks, has always made me nervous.
vjslib.dll doesn't even ship by default with either the framework or Visual Studio these days...

Subsonic\ORM on Windows CE\Mobile

Has anyone managed to get subsonic or a variant working on Windows Mobile? We cant get it to work as it has a dependency on System.Configuration.
Any suggestions on an alternate ORMs that would work on a windows mobile device?
A colleague of mine used EntitySpaces on a Windows Mobile project and was pretty pleased with it.
Is the System.Configuration dependency the only issue? If so, you could always try to get around it by adding that capability. For example OpenNETCF's SDF has an OpenNETCF.Configuration namespace that mirrors a lot of the System.Configuration namespace. You might be able to eitehr modify subsonic to use that namespace, or modify and recompile the SDF's assembly to use System.Configuration as a namespace.
You could look at something like LLBLGEN which shows support for the compact framework.