0

I want to add a Feature event receiver, that add a webpart to a page, I followed the steps in this link

But when I tried to deploy it , I hade the following error :

Error occurred in deployment step 'Activate Features': Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallersAttribute set for import to succeed.

How can I resolve this issue?

4
  • try deploying through powershell once, and see if it also throws same error, probably it should not
    – Gaurravs
    Sep 29, 2016 at 9:07
  • 1
    @Gaurravs , I found the FIX: Add the following to your AssemblyInfo.cs and recompile.usingSystem.Runtime.InteropServices;[assembly: AllowPartiallyTrustedCallers] . Thanks for you help ..
    – BKChedlia
    Sep 29, 2016 at 9:09
  • good. you can put it as answer. so someone seeking same will be helped
    – Gaurravs
    Sep 29, 2016 at 9:16
  • You will see Answer Your Question button below
    – Gaurravs
    Sep 29, 2016 at 9:38

1 Answer 1

0

FIX :

Add the following to your AssemblyInfo.cs and recompile.usingSystem.Runtime.InteropServices;[assembly: AllowPartiallyTrustedCallers] .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.