3

I have created an event receiver inside Visual Studio 2012. now i want to generate a .wsp file representing my solution to be deployed inside our live server. now i navigate to the following location inside my visual studio project

..\Documents\visual studio 2012\Projects\CustomerSitesER\CustomerSitesER\bin\Debug

and i found a .wsp file with the same name as my current solution. so i was planning to copy this file to our live server and do the deployment using (stsadm.exe -o addsolution & stsadm.exe -o deploysolution)... but i have noted that when i modify the feature elements.xml file inside VS 2012 , and i build the project the above .wsp modified date did not get changed,,, so not sure if simple copy this .wsp to live and do the deployment will it include the modified elements.xml file? so can anyone adivce what is the best way to deploy a .wsp file from Dev to live environments?

4 Answers 4

3

First off, a SharePoint solution package file is actually a cab file with a .wsp extension. If you switch the extension to .cab, you can open the file and extract the contents so you can examine if the feature.xml is what you think it should be.

Second, the debug .wsp will not change if you are compiling/rebuilding the solution in release mode/configuration. In this case, the .wsp file in the \bin\Release folder will be updated not the one in Debug.

Typically, it is the Release version that is taken and deployed to production in the way you describe.

My last thought is that you should deploy your solution to a staging environment first in order to ensure it actually works as you expect. This is best practice. If you don't have a staging environment, then you should clear dev of all the pieces that the package delivers and deploy the solution as if you had never done it before to ensure it is actually ready for production.

2
  • thanks a lot for your clear reply. so now i can copy the .wsp file inside the "bin/release" is this correct ? second point i did not understand what you exaclty mean by "you should clear dev of all the pieces that the package delivers and deploy the solution as if you had never done it before to ensure it is actually ready for production." ,, what are the things inside my event receiver that i need to clean ?can you explain this point in more details please ?
    – John John
    Commented Oct 12, 2016 at 23:07
  • If you build/compile for release then yes copy from bin/release. I don't know what is in your package exactly. If it is just an event receiver then after you retract and remove the solution from dev, I would make sure that the dll is no longer in the GAC and that the feature folder in the SharePoint hive is gone before you add and deploy the solution from scratch.
    – Erik Perez
    Commented Oct 12, 2016 at 23:43
3

The above answer is correct or you can have another option as-

Delete the .WSP files from the \bin\Debug folder and rebuild the solution. You can find the current/updated date to the WSP.

Or You can have the another option as above, Just => Right Click on the Solution and => Select Publish option and give the path as per you need.

You can find the latest WSP in the above mentioned path with the latest/updated date with the latest files in the solution.

Hope this will help you!

2
  • Delete the old .wsp file from \bin\debug\.
  • Rebuild and Publish the solution
  • You will get latest WSP file.
2
  • you mean i will get the latest .wsp file inside the "bin\debug" ? or inside the path i specified inside the Publish options dialog ? or both on these locations should give me the latest .wsp ?
    – John John
    Commented Oct 13, 2016 at 11:58
  • 1
    You will get latest wsp in \bin\debug\ as you have specified or \bin\Release\ (If you have selected Release in Visual Studio)... When you will publish, it will ask location to save wsp.. whenever you are saving it,. that wsp will be aslo latest wsp... Commented Oct 13, 2016 at 12:02
1

When you "Build" your SharePoint project only the DLL file gets updated. To get the WSP file you have to Publish the project from Visual Studio. Right-click the project and select Publish.

4
  • thanks for the reply.. so now i right click on the project>>then i select publish . and i chose the "c:_" location.. after that a new .wsp file was added at "_c:\test.wsp" .so this .wsp file is the one i can use? is this correct ?
    – John John
    Commented Oct 12, 2016 at 23:09
  • You got it. When you publish, you select a location to save the WSP file. Typically I put this in the BIN/debug or BIN/release folder depending on which type of release I'm doing but you can create it wherever you want. It will also ask you before overwriting if you haven't changed the location. Commented Oct 12, 2016 at 23:56
  • but what is the idea of adding the .wsp published file inside the bin sub folders? i mean i will only be copying the .wsp file to another environment not the whole project ,, is this correct ?
    – John John
    Commented Oct 13, 2016 at 12:01
  • The idea is that it keeps everything organized and so you know which WSP is Debug version and which is Release since they will always have the same filename and you won't be able to tell otherwise. I keep the original in my Release/Debug folders for organization and then move the WSP file to the server for installation. You can install the WSP from anywhere as long as Powershell/STSADM can see the file location. Commented Oct 13, 2016 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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