How to use Visual webpart in SharePoint 2010 in Sandbox Solution

Andres Morales picture Andres Morales · Nov 7, 2012 · Viewed 8.5k times · Source

I am trying to use a Visual Webpart in a sandbox solution. However every I deploy it: it gives me the following error:

Error 1 The deployment type "TemplateFile" of file "VisualWebPart1UserControl.ascx" in Project Item "VisualWebPart1" is not compatible with a Feature in a Sandboxed Solution.

I did some research and found out that Visual WP is not supported in Sandbox solutions. Is there anyway I can have Visual WP in a sandbox solution?

And is there any specific reason as to why Visual WP is not really supported in Sandbox solution.

Answer

Dmitry Kozlov picture Dmitry Kozlov · Nov 7, 2012

Use VS Sharepoint Power Tools. It has Visual Web Part item template for sandbox solutions. http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/