1

I'm developing some WebParts in a SharePoint 2016 project and I'm using a SharePoint Module to deploy some needed assets (js lib, images, ...) to the Style Library list and this is working fine.

Some libraries that I need are maintained via their NuGet Package, thus their files are located in a "Scripts" folder (bootstrap, jquery, ...).

Is it possible to change my SP Module to also target the files located in the "Scripts" folder?

I'm currently copypasting the files from the Scripts folder to my module but I'm sure there is a cleaner way to do it, I just can't find how... Relative path doesn't seem to work. Example:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyProject.WebAssets" Url="Style Library">
    <File Path="..\Scripts\bootstrap-datetimepicker.min.js" Url="js/boostrap-datatimepicker.min.js"/>
  </Module>
</Elements>

Thanks in advance :)

EDIT: I finally found a solution that suits my needing, I've written this on my WordPress blog: http://lyyn.fr.nf/wp/2017/09/21/sharepoint-selective-deployment-of-nuget-packages-via-a-module/

To be short, I make a module called "Scripts", thus it creates a folder "Scripts" and NuGet will target it. Then, I just have to update the Elements.xml file. It works really better than what I thought.

0

Yes you can refer to any folder in your project in SP Module to deploy that resource. Make sure you use Ghostable in library keyword as well to make them available in library.

  • That's weird. No matter what I do (editing the following module files: Elements.xml and SharePointProjectItem.spdata), that doesn't appear in my Feature nor in the Style Library. I must be doing something wrong. I also tried to add "GhostableInLibrary" but this work without it on the others file that are directly in the Module folder. – Lyyn Sep 19 '17 at 14:14
  • For any files that you want to appear in a document library, append the Type="GhostableInLibrary" attribute to their entry in Elements.xml <br/><br/> Reference : msdn.microsoft.com/en-us/library/ee231524.aspx – ThinkB4Code Sep 20 '17 at 5:49
  • Yeah I know that, this is not the issue actually. Anyway, I found a clean way to do what I want so I'm writing an article on my blog. I'll edit my post to add the link and the details when it's completed. To be short, I still use a module but its name is "Scripts", thus it create/use the same folder that NuGet use. I did the some for the "Content" folder, also used for some libraries. It works really better than what I thought. – Lyyn Sep 20 '17 at 8:00
  • 1
    Here is my answer to my question, a new blog post on my website: lyyn.fr.nf/wp/2017/09/21/… – Lyyn Sep 21 '17 at 11:19

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.