1

I have a VS macro that I've been using for years to build my projects automatically. I'm currently trying out VS 2010 to see if I like it (my regular version is 2005), and one segment of the macro is not working in 2010. Well, rather, it will work ONCE on a given day, and then every time I run it after that, it fails. Here is the code:

        With DTE.Solution
            'Set the Build to "Release"
            .SolutionBuild.SolutionConfigurations.Item("Release").Activate()
            'Build solution
            .SolutionBuild.Build(True)
            'Set Build back to Debug
            .SolutionBuild.SolutionConfigurations.Item("Debug").Activate()
        End With

The line that fails is ".SolutionBuild.Build(True)". It simply doesn't Build the solution. There's no error. No indication that something is wrong. The code will run, but it just doesn't actually DO the build.

Does anyone have any idea why this would be happening?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
WATYF
  • 409
  • 1
  • 5
  • 16

1 Answers1

2

My experience with it is that it does build.. if needed.

Try a Clean... if you want to rebuild every time.

DTE.Solution().SolutionBuild().Clean(True)

Thalia
  • 13,637
  • 22
  • 96
  • 190
  • No dice. I added that before the Build and it still failed to do anything. – WATYF Feb 05 '13 at 17:07
  • Sorry... I tried... I don't think it is because of VS2010 though, it is what I am using and it works for me. There was one other thing that I had to fiddle with though: I expected, when I changed to x64, for the SolutionConfiguration to change from Win32 to x64 but it didn't... I had to play with some of the parameters a bit to make it work in all 4 combinations. Maybe that is the problem ? – Thalia Feb 05 '13 at 17:12
  • Whatever it is, it has to be something related to VS 2010. I have this very same Solution in VS 2005 and it works just fine. If I take the 2005 Solution and open it in VS 2010 (which upgrades it) and then run the Macro, it no longer works. In fact, several other parts of the Macro "break" as well (due to whatever random changes they made to the behavior of the DTE in VS 2010), but this issue is the only part that I haven't figured out a work-around for. – WATYF Feb 05 '13 at 19:56