I have created a new Web API project using the ASP.NET 5 Templates. I am wanting to generate random numbers using System.Security.Cryptography.RandomNumberGenerator but it is not available in the .NET Platform 5.4 (see screenshot).
Compiling it also generates the following errors:
Error CS0234 The type or namespace name 'Cryptography' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)
Error CS0246 The type or namespace name 'RandomNumberGenerator' could not be found (are you missing a using directive or an assembly reference?)
Error CS0103 The name 'RandomNumberGenerator' does not exist in the current context
Is there a way to use this or is there an alternative random generator that I can use which is cryptographically secure?
I got it working thanks to Scott Chamberlain's comment by adding the System.Security.Cryptography.Algorithms NuGet package.
I also had to modify the project.json so it was only a dependency of dotnet5.4 and not a global dependency otherwise the compiler would complain that RandomNumberGenerator exists in both System.Security.Cryptography.Algorithms and mscorlib.
Related
I make my project based on this tutorial:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-3.1&tabs=visual-studio
It told me that it is missing directive or an assembly reference.
But I instal the related plugin, and the code generate successfully, I don't know why VS still can't find the code...
Here is the code content, the namespace is exist:
More info my proto properties:
Error Msg:
1>MainWindow.xaml.cs(6,7,6,23): error CS0246: The type or namespace
name 'HeartBeatMessage' could not be found (are you missing a using
directive or an assembly reference?)
1>MainWindow.xaml.cs(16,24,16,40): error CS0246: The type or namespace
name 'HeartBeatService' could not be found (are you missing a using
directive or an assembly reference?)
I found this question because I was running into this problem too. See: https://github.com/grpc/grpc/issues/20402
For now, I have manually moved the generated .cs files into my project and disabled the build step on the .proto (otherwise VS will complain about double definitions).
I had tried to make builds of the scene examples of the new MRTK version 2.0.0-RC1 on Unity 2018.3.10f1 but every time with every example there's a build error which says:
The type or namespace name 'HandJointKind' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'HandMeshObserver' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'JointPose' could not be found (are you missing a using directive or an assembly reference?)
Where do I get the library for this namespaces?
These types are part of the upcoming UWP SDK version 18362.
Download 10.0.18362.1 from https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewSDK
In the Unity Build Settings window, change the Target SDK Version to 10.0.18362.0, and make sure that Minimum SDK is is 10.0.10240.0.
This got me past the issue listed here. Then I ran into errors while trying to build the resulting solution. I had to upgrade all projects to C# language version 7.2.
how i can fix this problem??
help me
Compiler Error Message: CS0246: The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?)
Line 1: using MySql.Data.MySqlClient;
Apologies if this is not the case but working on the assumption that you're developing in a version of Visual Studio, check the project references.
If MySql.Data exists in the references but has the warning (yellow triangle) indicator next to it then you may need to re-reference the .dll from its location in your filesystem.
Alternatively, you can grab this from the Nuget package manager if it is not available locally.
Despite the full namespace qualification, the library must be correctly referenced for the object namespace to be recognised in the IDE.
Let us know what IDE you're using if not VS.
The type or namespace name 'DataServiceKeyAttribute' does not exist in
the namespace 'System.Data.Services.Common' (are you missing an
assembly reference?)
This is the error that I have been getting and its driving me crazy. I am trying to build a web portal and I am following this tutorial.
Now after extensive search I am done and out. My target Framework is .Net Framework4 and there are some assemblies, specially the one from CRM sdk with version 5.0.
Could this be an issue?
This Type is defined in the .NET Framework Assembly Microsoft.Data.Services.Client. Ensure that this assembly is referenced by your project and it should work fine.
I'm trying to upgrade one of our applications from Castle Windsor 2.1 to 2.5.
I've removed all of the Castle DLL's, and added the 2.5 version as downloaded from Castle's website:
Castle.Core.dll
Castle.Windsor.dll
Before doing the migration, I also had a reference on my project to:
Castle.Components.DictionaryAdapter.dll
However, according to Krzysztof Koźmic's post here, such reference is no longer necessary, since the DictionaryAdapter now comes bundled into Castle.Core.dll.
Upon removing it, I get errors all over the place saying:
Error 6 The type or namespace name 'DictionaryComponent' could not be
found (are you missing a using directive or an assembly
reference?)
and
Error 64 The type or namespace name 'DictionaryKey' could not be found
(are you missing a using directive or an assembly reference?)
and
Error 27 The type or namespace name 'DictionaryKeyAttribute' could not
be found (are you missing a using directive or an assembly reference?)
I then thought I'd add a reference to Castle.Components.DictionaryAdapter.dll, as it could be that CORE didn't have the types listed above implemented in it.
Doing that got rid of all the errors, but gave me a new one:
Error 8 The type 'Castle.Components.DictionaryAdapter.DictionaryAdapterFactory' exists in both 'd:.NET\app\libs\Castle.Core.dll' and 'd:.Net\app\libs\Castle.Components.DictionaryAdapter.dll'
The error happens on the following method implementation:
internal static ISettingService GetServiceFromAdapterFactory(NameValueCollection collection)
{
var adapter = new DictionaryAdapterFactory();
return adapter.GetAdapter<ISettingService>(collection);
}
Has anyone faced such problem when upgrading from 2.1 to 2.5 and could offer me some advice?
Thanks in advance.
To answer my own question here, this is what I had to change in my code.
Changed all the DictionaryKey to become KeyAttribute
Changed all the DictionaryComponent to become ComponentAttribute
Used Kernel.Register instead of Kernel.AddComponent
And obviously removed all the 2.1 DLL's and added the 2.5. You will notice that the DictionaryAdapter.dll has been removed, as it's now bundled within Castle.Core.dll
Hope that helps someone in the future.