2

I am trying to compile some C++/CLI using MSBuild. I am getting an error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppClean. targets(74,5): error MSB4062: The "CppClean" task could not be loaded from the assembly Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or assembly 'Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the 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.

A colleague of mine has fixed this error by installing Visual Studio 2010 SP1 on his machine, but I already have that installed (as well as Visual Studio 2012 with Update 1) yet am getting this error. I have checked the path from the error message, and both the Microsoft.CppClean.targets and Microsoft.Build.CPPTasks.Common.dll files exist.

The CPPClean task appears to be part of the MSBuild tasks specific to Visual C++. Is there any way to get this as a separate installer so that I can repair it, or as part an installer for another set of tools? Failing that, is there another way of fixing this error?

4
  • Does Microsoft.Build.CPPTasks.Common.dll contain CppClean class? You can check it with dotpeek / reflector. I.e. idea is to understand is it issue with a build, or with DLL? Commented Apr 16, 2013 at 16:27
  • @Lanorkin: Yes, the CppClean task is in the assembly. Commented Apr 16, 2013 at 16:29
  • 2
    Do you have it in GAC? Looks like it is requested by assembly name, not by file name: UsingTask TaskName="CppClean" AssemblyName="Microsoft.Build.CppTasks.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" You can use gacutil /l to check Commented Apr 16, 2013 at 16:33
  • Try adding /p:VisualStudioVersion=11.0 to MSBuild Commented Apr 16, 2013 at 22:20

1 Answer 1

2

Prompted by Lanorkin's comment, I checked the GAC and the Microsoft.Build.CppTasks.Common.dll assembly was not in there. I added it manually, and it now builds.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.