Cannot build and run test in C# : The “Xsd” task could not be loaded
from the assembly Microsoft.Build.CppTasks.Common, Version=12.0.0.0
Just as this document said, Xsd task has been deprecated from MSBuild since VS2017.
And it seems that your own project has something that needs to be compiled by the MSBuild XSD Task, so this error appears.
And your plugin should use MSBuild of VS2015 or earlier MSBuild to build this test project. So the error did not happen there.
Suggestion
1) So you should VS2015 or earlier VS to build your project.
2) Or you could manually add CppCodeProvider.dll
to the GAC under VS2017 and then you could build it in VS2017.
Solution
Run CMD as Administrator and then run:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\xxx\Common7\IDE\PublicAssemblies
gacutil /i Microsoft.VisualC.VSCodeProvider.dll
================================================
Update 1
It is quite strange why MSBuild of VS2017 will call a task dll from VS2013.
Microsoft.Build.CppTasks.Common, Version=12.0.0.0
is from VS2013.
So please try the following steps:
1) check whether you have defined a system environment variable called VCTargetsPath
and check if its value is related VS2013
. Anyway, you should delete that variable and then restart VS to test again.
2) also try to register these dlls into GAC:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Build.CPPTasks.Common.dll
or
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Build.CPPTasks.Common.dll
3) disable any third party extensions under Extensions-->Manage Extensions
4) try to repair VS or update VS to check if VS has broken.
.Net
target versions/frameworks might help. – Axel Kemper