locked
MSBuild.exe stops working with the message “error MSB1025: An internal failure occurred while running MSBuild” RRS feed

  • Question

  • I have migrated my project from VS 2008 to VS 2010, but still targeting the same framework 3.5. While running the MSBuild from Visual studio command prompt 2010, it stops working with the following error.

    MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
    System.ArgumentException: Parameter "targetName" cannot have zero length.
       at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgumentLength(String parameter, String parameterName)
       at Microsoft.Build.BackEnd.TargetSpecification..ctor(String targetName, IElementLocation referenceLocation)
       at Microsoft.Build.BackEnd.TargetBuilder.BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, String[] targetNames, Lookup baseLookup)
       at Microsoft.Build.BackEnd.RequestBuilder.BuildProject()
       at Microsoft.Build.BackEnd.RequestBuilder.BuildAndReport()

    MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
    System.ArgumentException: Parameter "targetName" cannot have zero length.
       at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Boolean needToValidateProject, String schemaFile, Int32 cpuCount, BooleanenableNodeReuse, TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary)
       at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)

    Unhandled Exception: System.ArgumentException: Parameter "targetName" cannot have zero length.
       at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, Dictionary`2 globalProperties, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Boolean needToValidateProject, String schemaFile, Int32 cpuCount, BooleanenableNodeReuse, TextWriter preprocessWriter, Boolean debugger, Boolean detailedSummary)
       at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
       at Microsoft.Build.CommandLine.MSBuildApp.Main()

    Tuesday, December 22, 2009 9:13 AM

Answers

  • Sharobel, please look at the DefaultTargets attribute of the project file being built. It will crash in this way if the value, split on semicolons, contains a whitespace value. For example.

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"

                        DefaultTargets="SendCompleteEmail;

                                              WTTMSBuildIntegration;

             ">

    will crash, to avoid the crash edit it like this

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"

                        DefaultTargets="SendCompleteEmail;WTTMSBuildIntegration">

    Can you please verify that this fixes the crash?
    If it does, can you tell me whether this text was the result of a hand-edit to the file, or conversion, or something else?

    Thanks,
    Dan


    developer on msbuild
    • Marked as answer by Sharobel Friday, January 8, 2010 12:52 PM
    Thursday, January 7, 2010 9:05 PM

All replies

  • Does your project compile correctly when you build it directly from VS 2010?
    This might be a bug in MSBuild, can you please file a bug via MS Connect https://connect.microsoft.com?

    -Karel
    Thursday, January 7, 2010 6:43 PM
    Moderator
  • This sounds like an issue we have seen before. Could you please tell me a little more about the project that you were migrating (language, project type: like SilverLight, XNA Game, or just a Console app) and any other details?

    Also, would it be possible to get a copy of the project file? If you, you can email to my address below.

    Thanks,


    Chuck England
    chuckeng@microsoft.com
    Visual Studio Platform
    Program Manager - MSBuild

    Thursday, January 7, 2010 7:14 PM
  • Sharobel, please look at the DefaultTargets attribute of the project file being built. It will crash in this way if the value, split on semicolons, contains a whitespace value. For example.

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"

                        DefaultTargets="SendCompleteEmail;

                                              WTTMSBuildIntegration;

             ">

    will crash, to avoid the crash edit it like this

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"

                        DefaultTargets="SendCompleteEmail;WTTMSBuildIntegration">

    Can you please verify that this fixes the crash?
    If it does, can you tell me whether this text was the result of a hand-edit to the file, or conversion, or something else?

    Thanks,
    Dan


    developer on msbuild
    • Marked as answer by Sharobel Friday, January 8, 2010 12:52 PM
    Thursday, January 7, 2010 9:05 PM
  • Thanks Dan, It resolved my problem
    Friday, January 8, 2010 12:52 PM
  • Great. Can you tell me how the file got in this state? Was it hand-edited? Or was it created by some tool like the project upgrading process?

    Either way it shouldn't crash, and it's perfectly fine to hand-edit. But if it was created by a tool, then this might be harder for folks to figure out, and it's more important to try to get the fix in before 4.0 ships. Can you let me know?

    Dan
    developer on msbuild
    Friday, January 8, 2010 5:10 PM
  • (responding to original post incase you have an alert set on replies to it)

    Great. Can you tell me how the file got in this state? Was it hand-edited? Or was it created by some tool like the project upgrading process?

    Either way it shouldn't crash, and it's perfectly fine to hand-edit. But if it was created by a tool, then this might be harder for folks to figure out, and it's more important to try to get the fix in before 4.0 ships. Can you let me know?

    Dan
    developer on msbuild
    Saturday, January 9, 2010 1:46 AM