Within Visual Studio 2010 SharePoint projects you might want to use the SharePoint Site Url that you have specified for your SharePoint project in Pre or Post Deployment scripts.
The SharePoint Site Url value can be retrieved using the $(SharePointSiteUrl) variable.
For example, this variable could be used in a pre-deployment script to deactivate certain features for the debug configuration.
To add the Pre Deployment script do the following:-
- From Visual Studio 2010
- Open your SharePoint Solution/Project
- Click Project Properties
- Click the SharePoint Tab
- Add the following script to the Pre Deployment Script text box.
echo SiteUrl: $(SharePointSiteUrl)
if "$(ConfigurationName)" == "Debug" (
stsadm -o deactivatefeature -name "Feature1" -url $(SharePointSiteUrl) -force
stsadm -o deactivatefeature -name "Feature2" -url $(SharePointSiteUrl) -force
stsadm -o deactivatefeature -name "Feature3" -url $(SharePointSiteUrl) -force
stsadm -o deactivatefeature -name "Feature4" -url $(SharePointSiteUrl) -force
stsadm -o deactivatefeature -name "Feature5" -url $(SharePointSiteUrl) -force
Hope that helps.
For more information on Pre and Post-Deployment steps see this MSDN Link:
How to: Set SharePoint Deployment Commands (http://msdn.microsoft.com/en-us/library/ee231534.aspx)
I’m wondering if there are other tokens that we can use in pre/post deploy commands and how to find them. Specifically I’m looking for the URL of where a SharePoint 2013 App was installed.
I have had a look around and can’t find anything that would suggest there is a token. To be honest you’d think it would be the same token as mentions in the post.