none
All custom build target rebuilt after a single custom target fails in VS2010 - workaround?

    Question

  • We've run into a problem with VS2010SP1 where if a custom build target fails, then on the next build, all custom targets get rebuilt. This really slows down development. 

    It sure looks like the custombuild rule is mishandling custombuild.command.1.tlog. Any suggestions? (One custom build target per project won't work)

    I am able to repro the problem in a small test app. Our sample custom build rule looks like:

      <ItemGroup>
        <CustomBuild Include="cow1.moo">
          <FileType>Document</FileType>
          <Command>"./Bovinator.py" -o "./$(ConfigurationName)/%(Filename).txt" "%(FullPath)"</Command>
          <Message>Bovinating</Message>
          <Outputs>./$(ConfigurationName)/%(Filename).txt</Outputs>
        </CustomBuild>
        <CustomBuild Include="cow2.moo">
          <FileType>Document</FileType>
          <Command>
            "./Bovinator.py" -o "./$(ConfigurationName)/%(Filename).txt" "%(FullPath)"</Command>
            <Message>Bovinating</Message>
            <Outputs>./$(ConfigurationName)/%(Filename).txt</Outputs>
          </CustomBuild>
      </ItemGroup>

    Friday, August 16, 2013 2:03 PM

Answers

All replies

  • Hi,

    According to your description, the problem is that if a custom build target fails,then all custom targets get rebuilt on the next build in VS2010SP1.

    I think that the problem is associated with the project properties.

    Please refer to Target Build Order  to check if the custom targets are set in right format. For example,InitialTargets specifies the targets that will run first, even if targets are specified on the command line or in the DefaultTargets attribute.

    Besides, please check the default property settings in Visual Studio,such as the Pre-Build Event.

    The following screenshot is from Visual Studio 2012.

    For more details, please refer to the links below:

    Understanding Custom Build Steps and Build Events

    Troubleshooting Build Customizations

    Here is the related topic below:

    Empty lines in the Custom Build Tool commands result in weird error (MSB8015)  

    Best Regards.

    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Monday, August 19, 2013 9:55 AM
    Moderator
  • Hi Jane. Thank you for the suggestions. This projects is using default build order so build order formatting isn't an issue. Nor are there newlines in a command. Thank you for thinking about it.
    Monday, August 19, 2013 12:11 PM
  • I was able to try out the test program on VS2012 and it seems to build correctly there. (I'd be more excited if we were able to move to 2012 this release cycle, so any workarounds appreciated.)
    Monday, August 19, 2013 12:13 PM
  • Hi,

    The  Target Build Order  were set correctly and you have built them on Visual Studio 2012 successfully,so I think this issue might have something to do with the targeted framework version in your projects.

    If so,please try the following solutions:

    1.Please verify the Targeted Framework in your project file with the following lines:

            <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

            <IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion> 

    2. Also,you can do this in Visual Studio.

    • For C++ projects,in the Property Pages dialog box, in the left pane, expand Common Properties and then select Framework and References.
    • For the targeted framework in an existing Visual Basic, Visual C#, or Visual F# project,in the Solution Explorer toolbar, choose the Properties button and check the settings on the Application tab.

    For more details,please refer to the following links:

    How to: Modify a Project System So That Projects Load in Multiple Versions of Visual Studio

    How to: Extend the Visual Studio Build Process

    Troubleshooting .NET Framework Targeting Errors

    If your problem remains,please provide the sample project file more completely for further analysis.

    Kind Regards.

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, August 22, 2013 11:38 AM
    Moderator
  • Hi Jane.
    Thanks for the suggestion. I'll give that a shot next week when I can.

    Thank you!

    Ray

    Wednesday, August 28, 2013 1:58 PM
  • Hi Ray,

    Thank you for your kind reply.

    Hope you solve your problem successfully.

    BTW,if you think the answer marked above doesn't help,please feel free to unmark it.

    And if you have other questions,please consider creating new threads so that more people would take part in the discussion and you could get the better response.

    Have a good day.

    Jane.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, August 29, 2013 1:49 AM
    Moderator
  • Hi Jane.

    Thanks for the suggestion. Looking at the project, it defaults to version 4.0. i also tried splicing in the line you gave, which did not alter the result. I would be happy to provide the c++ project. Can you you give directions to do so?

    Thanks, Ray

    Wednesday, October 16, 2013 5:52 PM