0

I have been working in a development environment and deploying my custom web part features from Visual Studio directly by just hitting F5. I now need a way to deploy features separately to a test environment and would like to know the best way to go about this. I know there is an "Install-SPFeature" command but it seems to require a feature.xml file. In my Visual Studio project I have a .feature file and a .template.xml file but no plain feature.xml file. How do I generate this feature.xml file to use the Install-SPFeature command or is there an even better way to deploy single features to a site?

2

You need the .wsp file that contains the features. You can create with Visual Studio by right clicking the Project and hit on Publish option. First af all, open a SharePoint Management Shell. You have to add the Solution to SharePoint with this command:

Add-SPSolution -LiteralPath $SolutionPath

Then, install the solution:

$Url = "http://urltoinstall"
$SolutionToInstall = Get-SPSolution -Identity "yourSolutionName.wsp"
Install-SPSolution -Identity $SolutionToInstall -WebApplication $Url -GACDeployment -Force

Remove the -WebApplication parameter if you want deploy globally.

Finally install the feature you want with this command

$FeatureName = "YourFeatureName"
Install-SPFeature $FeatureName -Force
$FeatureActivate = Get-SPFeature $FeatureName
Enable-SPFeature -Identity $FeatureName -Url $Url -Force

Hope this solves your question

  • So I have to first install the entire solution with all of my features before I can install a single feature? I'm trying to find a solution that allows 2 people to be working on different features at the same time and not run into overwriting issues. This method would only work if everyone working on the project makes sure they have the latest version every time they deploy a feature, wouldn't it? – Fenoec Oct 7 '13 at 16:36
  • The answer is yes. At least I don't know other way to manage what you need. But I don't understand when you say "This method would only work if everyone working on the project makes sure they have the latest version every time they deploy a feature" If you'd find a way to deploy only the feature you would have to get the latest version of the feature to test it in your stage environment. – Alvmad Oct 7 '13 at 17:07
  • Bummer. My thinking was that if you're wanting to deploy a feature then you're the one working on it and therefore have the latest version. Thanks though. – Fenoec Oct 7 '13 at 18:30

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.