问题
I am a little lost on erros like that:
Warning 7 CA2123 : Microsoft.Security : Add the following security attribute to 'RithmicConnector::Connect(String^)' in order to match a LinkDemand on base method 'IConnector::Connect(String^)': 'SecurityCriticalAttribute'. c:\work\nettecture\tradex\source\tradex.connectivity.rithmic\rithmicconnector.cpp 52 Tradex.Connectivity.Rithmic
Where do I add the SecurityCriticalAttribute?
I tried on the header file - but the error does not disappear. I have one of those pretty much on every exposed method of a (managed C++) interface DLL.
And I want CA to run through.
How do I fix those?
Regards
回答1:
You'll have to do two things:
- Add [assembly: SecurityCritical] to the assembly.
- Add [SecurityCritical] attribute to the specific methods containing critical code(or whatever else you wish to decorate).
Here's a blog entry that might be helpful Using Transparency in CLR
来源:https://stackoverflow.com/questions/2670291/c-cli-ca2123-requires-securitycriticalattribute