Showing posts with label Build Definition. Show all posts
Showing posts with label Build Definition. Show all posts

Wednesday 30 October 2013

Issues Generating wsp's using MSBuild in TFS2012

Problem: I am using a Build Definition within TFS2012 to try create a WSP package.  I am building a solution that contains multiple projects.  1 project needs to generate the wsp from it.  I have made minor customisations such as:
My Custom Build Definition
My environment is TFS 2012, VS2012 & SharEPoint 2013.

 Tip:  To clone Build Definitions you need to add the VSIX "Team Foundation Server PowerShell Tools 2012".

When I run the build I get the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (387): The "ValidatePackage" task failed unexpectedly.System.InvalidOperationException: The project service does not contain the specified project: 17939c4e-xxec-xxxx-xxxx-e18209d495db. at Microsoft.VisualStudio.SharePoint.Tasks.ValidatePackage.OnCheckParameters() at Microsoft.VisualStudio.SharePoint.Tasks.BuildTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocal


Resolution:
Install Microsoft Office Developer Tools for Visual Studio 2012 - RTM on the build controller (In my case I have TFS and I have a seperate Build Controller on my CI box so I install MS Developer Tools for VS 2012 - RTM on the CI box.

More Info:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/dc6e39e6-331d-42b2-ac16-b530ccb74d46/tfs-build-and-creating-a-sharepoint-2013-app-file



Tip: Another Point Worth Noting is the build definition can have problems if files names/locations are tool long created by the build controller.
   Tip: When setting up Visual Studio, shorten the length/location where the project/workspace is held locally as shopwn below:
 
 

Generating WSP's in CI for SP2013

There are some comprehensive blog posts on setting up Build automation.  This post is a short summary of creating SharePoint wsp files from a Visual Studio 2012 solution within TFS2012.

Prep Steps:
  1. TFS2012 containing source files.
  2. Need a build controller and a build agent, this can be on the TFS server or a separate server, in my case it is separated out.
  3. On the Server holding the build controller, you need the SP binaries.
  4. Install "Microsoft Office Developer Tools for Visual Studio 2012 - RTM"
  5. Create a new template or clone the default template and adjust it as shown below (You will need the VS extension (VSIX) "Team Foundation Server PowerShell Tools 2012" to clone an existing Build Template):
 
Add the Packaging switch under the advanced Tab in the Process tab

More Info:
http://msdn.microsoft.com/en-us/library/ff622991.aspx