Search code examples
msbuildvsix

Visual Studio Extension build failing with Error VSSDK1077: Unable to locate the extensions directory. "Value cannot be null


I have configured a TFS(2017) build pipeline to compile a VS extension with debug mode for a specific requirement which require .pdb files. The build solution task fails for "debug" configuration with below error, however same pipeline works for the release configuration. I have tried the approach mentioned in the following discussion as well, howewer it doesn't resolve my issue.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/fd220999-5761-475a-bf86-98dff6b35218/unable-to-compile-vsix-project-that-is-a-part-of-my-solution-using-amd64-msbuild-from-vs2015?forum=msbuild

Appreciate if someone can help me to resolve this issue.

Following is the build configuration used for the Build Solution task: enter image description here

Following build variables are used to configure build parameters. enter image description here

Build Error message:

packages\Microsoft.VSSDK.BuildTools.15.1.192\tools\VSSDK\Microsoft.VsSDK.targets (633, 5) packages\Microsoft.VSSDK.BuildTools.15.1.192\tools\VSSDK\Microsoft.VsSDK.targets(633,5): Error VSSDK1077: Unable to locate the extensions directory. "Value cannot be null. Parameter name: path1". Process 'msbuild.exe' exited with code '1'.


Solution

    1. Update your Microsoft.VSSDK.BuildTools NuGet package to latest version 15.9.3032, just in case it is a problem already solved.
    2. Release configurations can also generate PDB files (Project properties, Build tab, Advanced...button, Output > Debugging information). So, if the Release configuration works for you, you can keep using it while also generating a pdb file with full debug information.
    3. The error is happening when, once compiled correctly, the generated VSIX output file is going to be deployed to the folder for extensions of the experimental VS instance, which is a required step to debug the VSIX file. A possible explanation of the different behavior for Debug/Release configurations is that maybe your .csproj specifies <DeployExtension>False</DeployExtension> for the Release configuration. By default, if not set, that property is set to true in the Microsoft.VsSDK.targets file:

      <DeployExtension Condition="'$(DeployExtension)' == ''">true</DeployExtension>

    Since likely you don't need to deploy the VSIX to the VS experimental instance when building on a build server (because you are not going to debug it), you can set that property to False to skip the deployment. This can be done with a 3rd build configuration (ex: "DebugBuildServer"), for which you specify DeployExtension to False in the .csproj file, or sticking to two build configurations but passing the /p:DeployExtension=false in the MSBuild arguments of the Visual Studio Build task of your build pipeline.