New version of SPClientSideDeployment adds support for folder-based file deployment and automatic folder creation

I have just released version 2.0 of SPClientSideDeployment with two major enhancements:

  • Folder-based file deployment – this allows you to define a local folder in the DeploymentSettings.xml file. All files under this folder (and its sub-folders) will be processed by the tool.
  • Automatic folder creation – all folders on the target path will now be automatically created by the Visual Studio command.

Download it now!

You can download the latest version of SPClientSideDeployment from the Visual Studio Gallery.

Folder-based file deployment

In previous versions, each file to be deployed needed to be declared individually in the DeploymentSettings.xml file. This can be cumbersome for large projects. In this release you can now use the Folder element to define a local folder to be deployed to SharePoint. All files under this folder (and all of its sub-folders) will be processed by the tool. The schema for this new element is very similar to the File element. Review the inline comment below for more details.

<?xml version="1.0" encoding="utf-8" ?>
<DeploymentSettings>
	<Files>
		<!-- Define local items to be deployed by using a combination of File and Folder elements. -->
		
		
		<File localPath="Script1.js">
			...
		</File>
		<File localPath="Script2.js">
			...
		</File>

		<!-- localPath: Required. Local path of the folder to deploy. Relative to the current project. Value should not start with '/'. Files within this folder and all of its sub-folders will be processed. -->
		<Folder localPath="Scripts">
			<Destinations>
				<!-- Same usage as Destination element for File. targetFileName is not supported when this element is being used for Folder. All files in the local folder will be deployed to the target location using the local file name. The local sub-folder structure will be automatically re-created at the target location. -->
				<Destination targetWeb="" targetFolder="Style Library"/>
			</Destinations>
			
			<!-- Same usage as Metadata element for File. The same metadata will be applied to all files within this folder. -->
			<Metadata>
				<Field name="ContentTypeId" value="0x01010007FF3057"/>
			</Metadata>
		</Folder>
	</Files>
</DeploymentSettings>

The sub-folder structure of the defined local folder will be automatically re-created at the target location. For example, given the Scripts folder and its content below:

      Scripts\utility.js

      Scripts\Search\search.js

and the definition in the DeploymentSettings.xml file:

		<Folder localPath="Scripts">
			<Destinations>
				<Destination targetFolder="Style Library/Intranet"/>
			</Destinations>
		</Folder>

The file utility.js will be deployed to the Style Library, under the Intranet folder. The file search.js will be deployed to the Style Library, under the Intranet/Search folder. The Intranet folder under the Style Library and its Search sub-folder will be created automatically.

Remember to republish your deployment package if you are planning to update your existing DeploymentSettings.xml to use the new Folder element. This is because the DeployFiles.ps1 has been updated to support the new element.

Automatic folder creation

In previous versions, all folders on the target deployment path (specified via the targetFolder attribute) must exist at the target location when using the Visual Studio command. This however was not a requirement when using the PowerShell deployment script generated by the tool (as the script automatically creates any non-existing folder). This release brings the same capability to the Visual Studio command. Any non-existing folder at the target location will now be created automatically by the Visual Studio command, in the same manner as the PowerShell deployment script.

Conclusion

This release brings two major enhancements that aim to simplify your deployment configuration. I hope you find them useful – and as always, would love to hear from you with feedback and suggestion.

 

Advertisement

About Bernado

Based in Australia, I am a freelance SharePoint and Dynamics CRM developer. I love developing innovative solutions that address business and everyday problems. Feel free to contact me if you think I can help you with your SharePoint or CRM implementation.
This entry was posted in SharePoint, SPClientSideDeployment. Bookmark the permalink.

1 Response to New version of SPClientSideDeployment adds support for folder-based file deployment and automatic folder creation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s