locked
SolutionConfiguration2.Delete deletes all configurations of the same name regardless of platform RRS feed

  • Question

  •  

    Hi, we're developing PC & Xbox 360 games and I've been working on an addin function to allow us to clean up our solution and project configurations.  This is with Visual Studio 2005 SP 1 with the intellisense hotfix and Xbox 360 XDK 6534.4.

     

    I've hit two problems.

    The solution has (as an example) 3 different build/platform configurations:

    Game|Mixed Platforms

    Game|Win32

    Game|Xbox 360

     

    If I iterate through and find the SolutionConfiguration2 for any one of these three, it deletes all of them, the deletion does not discriminate by platform.

     

    This is also true of project deletes.  The DeleteConfigurationRow for projects only takes a name, no platform.  There's no way to select an individual configuration row for projects that I've been able to find to delete specific name|platform configurations.

     

    Is there a hotfix for this?  I've done some searching without any luck.  If not am I better off writing my own tools to fix what isn't working here?

     

    Thanks,

    Brent Scriver

    BioWare/EA

    Tuesday, March 25, 2008 2:02 AM

Answers

All replies

  • If I iterate through and find the SolutionConfiguration2 for any one of these three, it deletes all of them, the deletion does not discriminate by platform.

    Could you please clarify the meaning of this using some source code?
    Thursday, March 27, 2008 8:30 AM
  •  

    Hmm, is there an elegant way to post files?  I can compress an addin project and another basic project using multiple platforms to illustrate if there is a way to do so.

     

    Meh, using my web server.  Links:

    Addin:  http://www.oneoddsock.com/msdn/configdelete/cleanconfigs.zip

    Project with multiple platforms: http://www.oneoddsock.com/msdn/configdelete/multiplatformproject.zip

     

    The interesting work in the addin is done in the RemoveConfigsFunction.cs, lines 94 & 176.

     

    Attempting to remove either of the Code Analysis solution configurations (but not both) will result in both being removed.  Attempting to remove either of the Code Analysis project configurations (after having removed the solution configuration) without selecting both will remove both. 

    Saturday, March 29, 2008 12:57 AM
  • Hello,

    I have run into the same issue.  Here is how I iterate the SolutionConfigurations:

                SolutionConfigurations configs = dte.Solution.SolutionBuild.SolutionConfigurations; 
                List<SolutionConfiguration2> trash = new List<SolutionConfiguration2>(); 
                foreach (SolutionConfiguration2 config in configs) 
                    if (config.PlatformName != "Mixed Platforms"
                        trash.Add(config); 
                foreach (var config in trash) 
                    config.Delete(); 


    When I call config.Delete() it removes all configurations with the same name, not the one I had selected based on platform.

    Regards,
    Todd


    Wednesday, October 1, 2008 8:55 PM
  • Hello,

    First understand the configuration model, which is quite complex. See:

    With text:

    The convoluted build configuration automation model (EnvDTE/EnvDTE80)
    http://msmvps.com/blogs/carlosq/archive/2008/08/29/the-convoluted-build-configuration-of-the-automation-model-envdte-envdte80.aspx

    and visually:

    The diagram of the convoluted build configuration automation model
    http://msmvps.com/blogs/carlosq/archive/2008/09/01/the-fiagram-of-convoluted-build-configuration-automation-model-envdte-envdte80.aspx

    Once you understand that solution configurations are elements of a matrix (although the configuration model hides this fact for solutions, not for projects), it doesn't make sense to delete an individual item of the matrix, it only makes sense to delete items in the axis (platforms or configuration names.) That said, the SolutionConfiguration2.Delete method is misleading, as it is misleading to model solution configurations as a collection and not as a matrix.

    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com
    Thursday, October 2, 2008 9:00 AM
  • Hello Carlos,

    I have read a number of the posts on your site.  It has been a great reference while developing our VS Add-In.  Thank you for all your effort.

    Unfortunately I could not find an answer to this specific question.  I am not interested in deleting Solution Configuration items individually, I would like to remove Solution Platform Columns.  Our build requires "Mixed Platform" be selected.  I understand that we are not able to set the default solution platform as part of the solution file, so the easiest way to ensure the correct solution platform is selected has been to remove the additional solution platforms via the Visual Studio UI (VS2008).  This works well, but we must always remember to delete the additional solution platforms after adding a new project.  I understand why these solution platforms are automatically created, that is not a problem.  I would simply like an automated way to remove them.

    Regards,
    Todd
    • Edited by Todd Kobus Thursday, October 2, 2008 2:47 PM
    Thursday, October 2, 2008 2:16 PM
  • Hello Todd,

    There is no hope, I'm afraid. I have ellaborated a bit more in my last post:

    More on the build configuration automation model
    http://msmvps.com/blogs/carlosq/archive/2008/10/06/more-on-the-build-configuration-automation-model.aspx

    MZ-Tools: Productivity add-ins for Visual Studio: http://www.mztools.com
    Monday, October 6, 2008 11:07 AM