Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

MsBuild fails on VSTS build agent due to COMException #299

Open
itzamna314 opened this issue Mar 20, 2018 · 3 comments
Open

MsBuild fails on VSTS build agent due to COMException #299

itzamna314 opened this issue Mar 20, 2018 · 3 comments

Comments

@itzamna314
Copy link

I'm attempting to build some NuProj projects as part of a VSTS build pipeline. I'm invoking MsBuild with the following parameters:

/p:Version="$(version)" /p:OutputPath="$(Build.ArtifactStagingDirectory)\nuget\ci" /p:GenerateSymbolPackage=false

Those parameters work fine on my local machine, but when I run the build on the VSTS build agent, I get the following exception:

2018-03-20T19:22:13.2706739Z ##[error]packages\NuProj.0.11.30\tools\NuProj.targets(867,5): Error MSB4018: The "ReadPdbSourceFiles" task failed unexpectedly.
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {3BFCEA48-620F-4B6B-81F7-B9AF75454C7D} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at NuProj.Tasks.PdbReader.ReadSourceFiles(String pdbPath) in C:\projects\nuproj\src\NuProj.Tasks\ReadPdbSourceFiles.cs:line 36
   at NuProj.Tasks.ReadPdbSourceFiles.Execute() in C:\projects\nuproj\src\NuProj.Tasks\ReadPdbSourceFiles.cs:line 25
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

I was hoping that setting GenerateSymbolPackage=false would skip the ReadPdbSourceFiles task entirely, but that doesn't seem to be the case. I've also tried using both the x86 and x64 versions of MsBuild, but I get the same error with both versions.

When I check the registry on my local machine, I can see that {3BFCEA48-620F-4B6B-81F7-B9AF75454C7D} is registered to C:\Program Files\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\x64\msdia120.dll. My guess is that msdia120.dll either doesn't exist or isn't registered on the build agent. Is there any way to work around that dependency? Or any way to install it on the build agent during an earlier build step?

@itzamna314
Copy link
Author

I was able to find a workaround - I included the following flags to skip all .pdb creation:
/p:DebugSymbols=false /p:DebugType=None

I would like to be able to include .pdbs eventually, though, so any help on this issue would still be appreciated.

@AArnott
Copy link
Contributor

AArnott commented Mar 20, 2018

This doesn't block inclusion of PDBs -- this blocks including source files themselves into the package based on what is found in the PDB.

@itzamna314
Copy link
Author

Ah, gotcha. In any case, it would be nice to be able to include all available debugging information in the packages that are built on the build server.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants