19

Recently, our .Net client libaray is upgrading to compile against Net 4.0.After change the target framework to 4.0, the application has some compilation error.

InAssemblyInfo.cs:

[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]

Error 7 Warning as Error: 'System.Security.Permissions.SecurityAction.RequestMinimum' is obsolete: '"Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. Seehttp://go.microsoft.com/fwlink/?LinkID=155570 for more information."' `

In .Net 4.0, it shows that:SecurityAction.RequestMinimum as obsolete, and we treat all warning as error.

What I should do with it? - Just remove it(will this has some unexpected impact? for example when the dlls are used in IIS) or change to some other value?I am not familiar with .Net, especially its security mechanism.

Anyone can help on this? Thanks for any advice and comment :)

ΩmegaMan's user avatar
ΩmegaMan
32.2k13 gold badges110 silver badges138 bronze badges
askedJul 24, 2012 at 6:40
jeffery.yuan's user avatar

2 Answers2

21

FromMSDN:

In the .NET Framework version 4, runtime support has been removed for enforcing the Deny, RequestMinimum, RequestOptional, and RequestRefuse permission requests. These requests should not be used in code that is based on .NET Framework 4 or later.

So, just remove it.

answeredJul 24, 2012 at 6:46
Centro's user avatar
Sign up to request clarification or add additional context in comments.

5 Comments

Sorry for the late reply. Thanks, Centro, as you said, I just remove the tag, and it works : )
Just wanted to let you know that if you rely on VS2013 resgen autogenerated class file, you cannot avoid this warning unless you post-process the file manually/automatically.
is it ok to just remove the hole:[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)] ??
I'm not sure about fixing some security holes by this if it is what you mean. For more deep information why it was removed just look intothis post
@Centro Is that strictly speaking true? The warning message generated by Visual Studio says it is disabledby default. Also seelearn.microsoft.com/en-us/dotnet/framework/configure-apps/… andmsdn.microsoft.com/en-us/library/…
5

Some searching led me here for a similar VB.net rdlc error (so yes, I know the question was tagged C#). I did not utilize the offending code, but I did find that a stray underscore caused this error, for example: in a textbox expression you might accidentally put:

"This is a " & _"test"

thinking you are in some code behind, but alas this generates this same error as listed above and once removed, the error was gone.

answeredFeb 1, 2013 at 22:12
Skeletonometer's user avatar

1 Comment

I saw the same with mismatched parenthesis

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.