Question

I'm looking for a way to build our onpremises (both 2013 and 2016) solutions in our Visual Studio Online repository.

I set up a standard .Net desktop build to build our solutions on a hosted VS 2017 which states to have Office tools installed.

However, the build fails with all SharePoint objects that are not found:

Error CS0234: The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

All articles I've red are explaining how to do that in old versions of TFS.

How to fix my build ?

Is it possible with hosted VS 2017 agents?

Is there a way to put additional DLLs in the build (which are normally referenced from the GAC of the dev computer) ?

Était-ce utile?

La solution

You can definitely do this. I am building SharePoint 2010 and 2013 WSPs on hosted agents on VSTS. It should be pretty much the same approach for 2016 and 2019.

Hosted agents have the binaries for SharePoint 2013 already installed. So you only have to set the packaging switch in the build arguments (I haven't tried on a hosted 2017 agent though) - this list with installed software seems pretty up-to-date: http://listofsoftwareontfshostedbuildserver.azurewebsites.net/

If you want to build other SharePoint versions you can switch back to the good old manual approach:

  1. Gather the SharePoint related assemblies from a farm and check them in into TFVC
  2. Add the location of the checked-in assemblies to the build arguments

Required assemblies I (source: C:\Windows\Microsoft.NET\assembly\GAC_MSIL)

  • Microsoft.Office.SecureStoreService Microsoft.VisualStudio.SharePoint
  • Microsoft.VisualStudio.SharePoint.Commands.Implementation.V5
  • Microsoft.VisualStudio.SharePoint.Designers.Models
  • Microsoft.VisualStudio.SharePoint.Designers.Models.Features

  • Microsoft.VisualStudio.SharePoint.Designers.Models.Packages

  • Microsoft.VisualStudio.SharePoint.ProjectExtensions.CodeGenerators
  • Microsoft.VisualStudio.SharePoint.Remote
  • Microsoft.VisualStudio.SharePoint.Wsp

Required assemblies II (source: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI)

  • Everything SharePoint related you need, Microsoft.SharePoint.*.dll is probably a good starting point

Enable packaging and add assembly path in the Build Solution task in build definition

enter image description here

Assemblies are quoted from this article by Matthias Baumann: https://matthiasbaumann.me/2013/03/10/setting-up-tfs-build-server-for-sharepoint-2013/

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top