Is there a way to set/adjust the Assembly Security levels (Transparent, critical, etc...) on a project? According to this MS article we can define them by adding a line like this to the top of the namespace:
using System.SomeOtherNameSpace;
[assembly: System.Security.SecurityTransparent]
namespace MyProject.MyTransparentNameSpace
{
//whole bunch of classes and enums
}
But is there a setting somewhere that I can add this attribute to my project rather than defining this in the code?
A little bit background:
I have a MS.Net FrameWork 4.7.2 project (let's call it Project High-Level) that references a .Net Standard 2.0 project (let's call it project low-level) and in project low-level, there are some public namespaces, classes and enums that are used throughout High-Levelproject.
I was getting MethodAccessException
on a line in the High-Level project that references an enum from low-level (.NetStandard) project. All my methods, classes and interfaces were public, even looking at the values through Watches worked fine, however, I kept getting Method HighLevel.XXX cannot access method LowLevel.get_enum()
exception. I tried many things and at the end of the day, using that [assembly: ....]
got rid of the issue.