locked
programmatic compilation with VSProject related objects for C# projects. . . RRS feed

  • Question

  • Hi,

     

    I've seen information on using Microsoft.Build to perform programmatic build of VS projects, such as:

    http://social.msdn.microsoft.com/forums/en-us/vsx/thread/90BB15B4-2589-468B-B176-F4FA51E7F52D

    but I'm extending a project that is using VCProjectEngine.VCConfiguration to build C++ projects.  It seems much more natural to be using the C#/VB counterparts of this group of objects (i.e. DTE), rather than Microsoft.Build.

    Is there no access to build methods for VSProjects in the DTE?

    Can anyone tell me the preferred way to build C# projects with VS 2010 Extensibility objects?  Or is Microsoft.Build the right direction to take?  It seems totally unrelated to the DTE extensibility. 

    For instance, if I wanted to modify the references of the project, I can do so with VSProject2.References.   It seems that if I'm stuck with Build, I might as well just modify the .csproj file myself . . .

     

    Thanks for your help, Geof


    GS @ School of Computing, University of Utah
    • Edited by Geof2323 Friday, November 19, 2010 3:04 AM adding detail to question
    Friday, November 19, 2010 1:57 AM

Answers

  • Hi Geof,

     

    Thanks for your post.

    As far as I know, there is no API to rebuild a single project in DTE.

    But I think you can try to execute command

    "Build.RebuildOnlyProject"

    "Build.RebuildSelection"

    "Build.RebuildSolution"

    with DTE.ExecuteCommand("")

    Hope this can help.

    Best Regards,

    Ziwei Chen

     

     

    • Marked as answer by Victor_Chen Friday, November 26, 2010 5:54 AM
    Tuesday, November 23, 2010 2:11 AM

All replies

  • Hi Geof,

     

    Thanks for your post.

    I suppose you'd like to build a non-VC project programmatically via DTE.

    Could you please try SolutionBuild.BuildProject Method.

    If I misunderstand your issue, be free to let me know.

    Best Regards,

    Ziwei Chen

     

     

    Monday, November 22, 2010 3:39 AM
  • Hi Ziwe,

     

    Thanks for your response.

    So this is my question wrt this method:  will I have to change or delete target files to force a rebuild?

     I'm guessing so.  I was hoping there was a 'Rebuild' method.

    Cheers,

    Geof


    GS @ School of Computing, University of Utah
    Monday, November 22, 2010 8:47 PM
  • Hi Geof,

     

    Thanks for your post.

    As far as I know, there is no API to rebuild a single project in DTE.

    But I think you can try to execute command

    "Build.RebuildOnlyProject"

    "Build.RebuildSelection"

    "Build.RebuildSolution"

    with DTE.ExecuteCommand("")

    Hope this can help.

    Best Regards,

    Ziwei Chen

     

     

    • Marked as answer by Victor_Chen Friday, November 26, 2010 5:54 AM
    Tuesday, November 23, 2010 2:11 AM
  • Well, thanks for the insight.  I'll give it a try and let you know.

     

    Best,

     

    Geof


    GS @ School of Computing, University of Utah
    Tuesday, November 23, 2010 2:29 AM
  • any reference with ALL commands like this: "Build.RebuildOnlyProject" "Build.RebuildSelection" "Build.RebuildSolution"
    Should "Hi", "Thanks" and taglines and salutations be removed from posts? http://meta.stackoverflow.com/questions/2950/should-hi-thanks-and-taglines-and-salutations-be-removed-from-posts
    Thursday, December 2, 2010 9:12 AM
  • Thank you very much for your effort on this.  I have had good results with your advice.

     

    Cheers,

     

    Geof


    GS @ School of Computing, University of Utah
    Thursday, December 2, 2010 8:46 PM