www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22747] New: VS 2022 Could not load file or assembly

https://issues.dlang.org/show_bug.cgi?id=22747

          Issue ID: 22747
           Summary: VS 2022 Could not load file or assembly
                    'Microsoft.Build.CPPTasks.Common, Version=17.1.0.0'
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: visuald
          Assignee: nobody puremagic.com
          Reporter: rmanth gmail.com

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.

--
Feb 08 2022