1
votes

I was just tryng to create a simple webpart in visual studio 2010 (for sharepoint 2010) I created an empty sharepoint project, then added a webpart. I wrote a simple code (pasting it from a book with examples) I Build the project, then deploy it (without errors)

Then when i go to the webpage where i want to add my webpart, i get this error when adding it:

"unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: $Resource:core,ImportErrorMessage;"

Any idea about it? If it's needed i'll post the code of the .cs file

Thanks

2

2 Answers

0
votes

i don't know why but the second try worked i can't say exactly what went wrong the first time, but i never get the same problem now

0
votes

I've figured this one out, its something to do with the manifest and features xml files that are generated along with the project.

When you start you should have a namespace like this.

ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy

But for some reason in those xml files it's added as

ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy.

With an extra '.' (dot). The fix open something like notepad++ do a search through the project and at first look for

ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy..

They should be in the manifest/features files. Change to a single dot so should have something like

<type name="ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy.DisplayWebPartWithProxy, $SharePoint.Project.AssemblyFullName$" />

Next do a search for a single dot. There should be one in the safe list, remove the single dot. Try the deployment again - should be ok.