4

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) ?

2

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/

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.