Building wsp from post-build event command line - sharepoint

What is the command for building WSP from post-build event command line?
I'm adding one more image so that you can understand my exact requirement.

You can build a WSP by using MSBuild. Each SharePoint project is build with the parameter
IsPackaging=True
By adding this parameter to the msbuild command you can ensure that all WSPs will be created.

You will have to depend on external tools like makecab.exe or WSPBuilder.
http://www.developerfusion.com/community/blog-entry/8390127/tfs-teambuild-and-sharepoint-wsp-deployment-and-any-post-build-events-for-that-matter/
http://www.fftf.org/news/Jul07feed/SharePoint_Solution_Deployment_Handy_PostBuild_Events.rss.html

I found the answer from here and it works for both SharePoint 2007 and 2010.
call "C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe" -ProjectPath $(SolutionDir) -OutputPath $(SolutionDir) -SolutionPath $(SolutionDir)

This seems to be VS2010.
If you choose the project template to be a SharePoint 2010 project then you will find items in the context menu that are related to SharePoint. If you choose deploy, it will create the wsp package automatically and deploy it to the server.

To force Visual Studio to create a wsp on post build for SharePoint solutions, add these properties to the project xml. If you already have a post build event defined, just add the two inner tags to the existing property group. Visual Studio will create the wsp in the configured location; Release or Debug.
To edit the project xml unload the project in visual studio then right-click on the project and select edit.
<PropertyGroup>
<IsDebugging>False</IsDebugging>
<PostBuildEventDependsOn>$(PostBuildEventDependsOn);CreatePackage</PostBuildEventDependsOn>
</PropertyGroup>

Related

TFS 2012 build copy console application to _PublishedWebsites

I am using TFS 2012 build option to build my web application. I have couple of console application in the solution. I want the console application output to be copied to the bin folder. In visual studio, I am doing this by using the copy command in the Post build event command option. But this does not work in TFS builds. The generated exe is not copied to the _PublishedWebsites folder in the BuildAgent directory
Possibility duplicate to Problems with MSBuild OutputPath and OutDir in TFS2010 .
Also give a try wiht this NuGet package, you can install it which will do this.
With TFS 2012 build process template, you need to custom build process template to run the script after building, like the post-build scripts feature in TFS 2013 build process template.
You can refer to this article to custom build process template to achieve your requirement.

Create SharePoint WSP without DLL?

I'm trying to build a WSP using the Visual Studio 2013 template for SharePoint - without it including the primary DLL of the project.
I tried removing AssemblyInfo.cs and all the references, it still builds the DLL and includes it in the manifest.
Is there a way to configure the project so that it omits the primary DLL (even if it does build it)?
(If anyone asks the "why would you want to do that" question, i'd be happy to answer it but doing so won't help me.)
Thanks
-John
In project properties, set "Include Assembly in Package" to False. Then publish to generate your WSP file. This new WSP will not contain the DLL.

Develop Visual Web Part Without Installing Sharepoint

I want to know if it is possible to develop web parts without installing sharepoint?
I choose Visual Web Part then I get sharepoint not installed error.
You can't develop it without SharePoint on same machine.
The answer is "Yes", you can. But if you do that then you loose all features of Visual Studio for development for SharePoint. You will need to create proper visual web part project artifact structure manually which could be tricky. Also you will have to create wsp package manually or using tools like wsp builder. Then you can copy this wsp package to sharepoint server and deploy it.

How to create SharePoint web part from Class Library project?

I got a SharePoint web part proejct wth the output type set to Class Library to deploy on SharePoint farm. It all bulds great no errors.
However, The project doesn't package as DWP because of the output type - In the Build menu VS2010 doesn't show Package item.
What is the way to create DWP package from this type of a project in Visual Studio 2010?
Should I create a new web part project from an empty SharePoint web part project and add the the cs files to complile and new project? or there are some good ways?
Thanks,
Val
Yes, you can create a SharePoint Web Part project in Visual Studio and then add your class library project to it. There will be an option to package your web part project into a wsp file and deploy it. Make sure you add your class library to the GAC though in the web part project.

Invoke a publish from msbuild for visual studio 2012

For VS2010 and before I was utilizing Web Deployment Projects (WDP) to help package my website for production deployment. I had a MSBuild script that compiled the solution in release mode. An output of that was production ready website files compiled and cleaned by the WDP.
I see for 2012 WDP have been removed, and a new tab has been created in the properties for the web application. The options are the same, but now the invocation of this is done via the Publish option (before you just compiled in release mode).
So the question is this. From an MSBuild script, how do I invoke a Publish operation? I found some old posts that...
msbuild /target:publish
would do the trick. But that doesn't seem to work in 2012.
Also, I tried in my msbuild task...
<MSBuild Properties="Configuration=Publish;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\MySolution.sln"></MSBuild>
...but msbuild just reported "unknown configuration".
How can I have msbuild run the publish option from the command line?
It appears that there are now some other options for publishing from the command-line. Specifically something along the lines of the following seems possible now with some RC updates to Visual Studio 2012.
msbuild mywap.csproj /p:DeployOnBuild=true;PublishProfile=MyProfileName
For more details check out this post by Scott Hanselman and check out the section on Publishing.
I wasn't able to get the publish to run, but looking at the output from Visual Studio I think I have found an alternate solution. Turns out the obj\Release\AspnetCompileMerge folder has a deployable and clean version of the project. It contains byte identical files to the final output folder.
I did have to change my msbuild script to include the DeployOnBuild option...
<MSBuild Properties="Configuration=Release;DeployOnBuild=True;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\BigWave.ALL.sln"></MSBuild>

Resources