roli09
roli09

Reputation: 1001

Why can't I build VSTO projects anymore on my build servers?

Since updating Visual Studio Build Tools on our build servers to 17.2 (we had 17.1.6 before), we can't build VSTO projects anymore.

We get the following error:

"D:\6\s\vsto-test.sln" (default target) (1) ->
"D:\6\s\src\ExcelAddIn1\ExcelAddIn1.csproj" (default target) (2) ->
(ResolveAssemblyReferences target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2302,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [D:\6\s\src\ExcelAddIn1\ExcelAddIn1.csproj]

I still can build them on my local dev machine using Visual Studio Enterprise or MSBuild commands.

Upvotes: 0

Views: 688

Answers (2)

roli09
roli09

Reputation: 1001

I think I found the issue:

Since version 17.2 of the Buildtools for Visual Studio 2022 the file C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\AssemblyFolders.config is missing.

This file contains the path to the assemblies, which could not have been found before (Microsoft.Office.Tools.Common.v4.0.Utilities, ...).

My local installation of Visual Studio Enterprise 2022 17.2 and installations of the Buildtools for Visual Studio 2022 prior 17.2 both install the file AssemblyFolders.config and thus have no issue.

Upvotes: 1

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66286

Make sure you install VSTO when you install Visual Studio. You will also want to avoid adding your target Office app (Excel in your case) as a reference from the COM tab unless Office is installed on your build server.

Upvotes: 1

Related Questions