I'm working on a webpart that extends CoreResultsWebPart. I have create new solution and added new WebPart project into it.

I got most of it working apart from XSL.

I want to use this.XslLink however, I'm not sure how to deploy my XSL file with my webpart (while keeping it as sandbox solution).

Do I need to create another feature (farm) just so I can deploy XSL file?

  • you can upload your xsl file to one of your document library. – bagus ilman Aug 1 '12 at 7:07
  • this is exactly what I dont want to do. I want everything to be deployable as a solution rather than having to upload stuff in other places. – Luke Aug 1 '12 at 20:07

You can provision the XSL file using a Module element and then reference that xsl file using a site relative url, like this:

<Module Url="Stylesheets">
    <File Path="MyModule\file.xsl" Url="file.xsl"/>


| improve this answer | |
  • Thank Wictor. I would have to deploy this solution as farm solution then. How do you deploy a file to Style Library/XSL Style Sheets, rather than file system. – Luke Aug 1 '12 at 21:19
  • This exact code can be used in the sandbox – Wictor Wilen MCA MCM MVP Aug 1 '12 at 21:32
  • It comes up with is not compatible with Sandboxes solution error. – Luke Aug 1 '12 at 21:48
  • @Wiktor Thanks. Instead of modifing elements file. I have added new project of type of Module which then deployed files fine. – Luke Aug 2 '12 at 2:44
  • Awesome Luke! That's a better approach! – Wictor Wilen MCA MCM MVP Aug 2 '12 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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