dotnet build for VSIX project with VSSDK fails with MSB4062 for CompareBuildTaskVersion
See original GitHub issueSDK Version: 3.1.301
If I run dotnet build
on my repo, I get the following error:
d:.nuget\packages\microsoft.vssdk.buildtools\16.6.2058\tools\VSSDK\Microsoft.VsSDK.targets(90,5): error MSB4062: The “CompareBuildTaskVersion” task could not be loaded from the assembly d:.nuget\packages\microsoft.vssdk.buildtools\16.6.2058\tools\VSSDK\Microsoft.VisualStudio.Sdk.BuildTasks.16.0.dll. Could not load file or assembly ‘Microsoft.VisualStudio.Sdk.BuildTasks.16.0, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\repos\Path\To\My.csproj]
If I just run msbuild
(16.6), it builds successfully.
I can see in the binlogs that the same targets being executed (VerifyTargetVersion
in Microsoft.VsSDK.targets
executes CompareCommonBuildTaskVersion
- which succeeds in both cases - and then CompareBuildTaskVersion
- which succeeds with msbuild
but fails with dotnet build
).
I’m not sure whether this is a VSSDK issue or a dotnet sdk issue, but since it worked in vanilla msbuild, I figured I’d start here.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:10 (4 by maintainers)
Top GitHub Comments
I hit this, building a VSIX project in an internal VS2022 build (17.0.0 Preview 1.0 [31312.303.main]):
Upgrading the
Microsoft.VSSDK.BuildTools
package from 15.8.3253 to 16.9.1050 resolved the issue.@kfertitta I have the same issue and also believed I needed the build tools that matched the oldest version supported. But I just tried building with the 17.0 prerelease build tools and found the result ran fine on 16.9. Perhaps that was just good luck, or perhaps only the SDK (and interop types) need to be the oldest version, but the build tools can be later? Example from Mads Kristensen of a 2017 extension with 2022 build tools: https://github.com/madskristensen/ExtensionPackTools/commit/e7ec8d5796c93da2b347e78a2eef3fdaa3356f3d#diff-64358be7ce06ce02708ac447688269a3d49c797d5610e9b60248a697a3dbf899R115