Bug 22747 – VS 2022 Could not load file or assembly 'Microsoft.Build.CPPTasks.Common, Version=17.1.0.0'

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
visuald
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2022-02-08T12:42:46Z
Last change time
2022-04-03T12:21:37Z
Assigned to
No Owner
Creator
Richard Manthorpe

Comments

Comment #0 by rmanth — 2022-02-08T12:42:46Z
C:\Program Files (x86)\VisualD\msbuild\dcompile.targets(192,5): error MSB4062: The "dbuild.CompileD" task could not be loaded from the assembly C:\Program Files (x86)\VisualD\msbuild\dbuild.17.0.dll. Could not load file or assembly 'Microsoft.Build.CPPTasks.Common, Version=17.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 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. I'm running Visual D v1.2.0 Visual Studio 17.0.5+32112.339 The CPPTasks DLL version shipped with VS is Microsoft.Build.CPPTasks.Common, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a I believe the problem here is that MSBuild no longer comes with binding redirects for Microsoft.Build.CPPTasks.Common. The current version of Visual Studio (17.0), and crucially the version of Microsoft.Build.CPPTasks.Common.dll it ships with (17.0.0.0) do not match the version that Visual D was built against (17.1.0.0). As I understand it, since MSBuild no longer includes binding redirects for this DLL VS now includes a new DLL (Microsoft.Build.CPPTasks.Common.Base.dll) with a version number that will remain stable across minor versions and only be updated for major releases. I think if you target this DLL both in dbuild.csproj and with CPPTasksPath in dbuild.targets it should work across all Visual Studio 2022 minor versions.
Comment #1 by r.sagitario — 2022-02-11T17:34:50Z
Thanks for the reminder. Unfortunately the *Base.Dll doesn't seem to work, so I created two versions of dbuild for 17.0 and 17.1. I cannot really verify as I cannot install both versions at the same time, so can you try it with https://gist.github.com/rainers/6cdf73b48837defb9f88/raw/adb40bdac26c07b57ebce92627563aff2b7b5f75/VisualD-v1.2.1-beta1.exe ?
Comment #2 by rmanth — 2022-02-12T00:10:14Z
I tested it out on 17.0 and it worked perfectly, thanks!
Comment #3 by r.sagitario — 2022-04-03T12:21:37Z