If you are trying to include Template File, Images, Layouts in Package. In Visual Studio 2010 will raise an error like “The deployment type "TemplateFile" of file "XXXUserControl.ascx" in Project Item "XXXUserControl" is not compatible with a Feature in a Sandboxed Solution.”

In my solution I am trying to add images to document library. It will work. But it is not an automated process when we deploy through VS. what is the best way to include Template File, Images, Layouts in Sandboxed solution?

1 Answer 1


In a sandboxed solution cannot deploy files within the SharePoint root directory or any other location on the file system of the web server. That means you cannot deploy branding files to familiar locations that are commonly used in farm solutions, such as the IMAGES directory or the LAYOUTS directory. You must instead provision branding files, such as images and CSS files, inside the content database within the scope of the hosting site collection.

In SharePoint 2010, every site collection has its own Style Library. That's because Microsoft has moved the standard provisioning instructions for creating the Style Library out of the publishing features and into the Global site definition. Each time SharePoint Foundation 2010 creates a new site collection, it adds the Style Library to the top-level site.

This makes the Style Library an ideal candidate for deploying CSS files and image files in a generic branding solution.

For more details you can check following:


One another alternative may be using embedding resource but you may need to write code to access those.


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.