Reputation: 729
this is my problem with VS :S
in the first project :
System.Security.Cryptography.AesCryptoServiceProvider obj;
everything is ok
in the second project:
System.Security.Cryptography.AesCryptoServiceProvider obj1;
it doesn't recognize the AesCryptoServiceProvider?!!
is VS using different packages or what ?!
updated: changed the variable name but still not working
Upvotes: 0
Views: 457
Reputation: 7486
Check if both projects are referencing System.Core
. Probably only the first one has it. You've to add it on both to be able to use AesCryptoServiceProvider
.
Moreover, as you can see here AesCryptoServiceProvider
is only available since .NET 3.5. Check your project's properties, in particular the Target Framework.
Upvotes: 2
Reputation: 498972
var
is a reserved keyword. Use a different identifier name or @var
.
System.Security.Cryptography.AesCryptoServiceProvider @var;
This may not be the problem - you need to ensure that each project has a reference to System.Core
the assembly containing System.Security.Cryptography
.
You will also need to ensure that you are targeting a framework version that contains this class (.NET 3.5 and above) - this can be done in the project property pages.
Upvotes: 5
Reputation: 37798
You can't name a variable var
because it's a reserved word, use a different name, this will not cause an error :
System.Security.Cryptography.AesCryptoServiceProvider _var;
Edit :
AesCryptoServiceProvider
is only supported in .Net framework 4 and 3.5 SP1, change the target framework and it will work and be sure to have System.Security.Cryptography;
in that file.
Upvotes: 1
Reputation: 3372
Are the references the same between both project? Just open references and see. I bet you are missing one. However, you really should use a different variable name than var. Also, can you post the exact error?
Upvotes: 1