Run NTiers get me a System.NotSupportedException CAS Policy. What can I do to circumvent this problem????

When I Run NTiers, I get System.NotSupportedException: This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons a System.NotSupportedException CAS Policy. What can I do to circumvent this problem????

The fix they give in msdn is to set a tag in app.config file and I cannot do that in .nettiers template.

I am also having the same error on Win 7 X64 machine using CodeSmith that I just downloaded today 6.X and using NetTiers template version 2.3.1 downloaded from Google. A bit of information that might be helpful is that everything was working fine while using the template bundled with the CodeSmith download but after updating the template it starts to fail.

This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see go.microsoft.com/fwlink for more information.

Thanks for posting this. I haven't been able to reproduce this issue following your steps. If you move the .netTiers templates that you downloaded to a user directory like (my documents) do you get this error? What are your UAC Settings set to?

I moved the NetTiers_2_3_1 to C:\Users\Rob\Documents\CodeSmith\Samples\v6.0\Templates\Frameworks\NetTiers_2_3_1 and tried again. Same error. I ran the CodeGenerator as Admin, same error. I retried the v6.0 NetTiers that came with CodeGenerator and it still works. Only the 2.3.1 template.

My UAC settings are:

"Notify me only when programs try to make changes to my computer (do not dim my desktop)"

I just downloaded the latest Generator 6.0.2 to try to get rid of my error but it didn't help. Please advise.

This is the error I got right after it generated the Procedures.xml file

NetTiers.csp(0,0) This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see go.microsoft.com/fwlink for more information.

Full Error:

Error: NetTiers.csp(0,0) This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see go.microsoft.com/fwlink for more information.

I forgot to include that I am running on Windows 7 Professional SP1 x64 bit and using Visual Studio 2010. But I can't "generate" using just code smith or inside of Visual Studio 2010. Neither one will generate without that error. Please advise. I need to generate.

I was finally able to over come this by editing the file "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config and adding <NetFx40_LegacySecurityPolicy enabled="true"/> to the <runtime> section of that config. I also noticed that after that it was best only to "generate" inside of Visual Studio 2010. If I tried to generate just using code smith, it would error out again and I wouldn't be able to generate again until I closed my Visual Studio and used VS only to generate.

I'd highly recommend generating .netTiers outside of Visual Studio as that is the way the templates were initially designed. This error is a result of downloading the templates from the web. If you right click a zip and mark it as unblocked this error will go away.