none
Project Template Wizard: How to set up StartUrl Property of a Web Project ? RRS feed

  • Question

  • Hi,

    I have a template wizard which builds Web Application. I want to set tup automatically the StartUrl property.


    I have tried the following code in my Wizard:


            public void ProjectFinishedGenerating(EnvDTE.Project project)
            {
                if (project != null)
                {
                    foreach (EnvDTE.Configuration configuration in project.ConfigurationManager)
                    {
                        EnvDTE.Property ptStartAction = configuration.Properties.Item("StartAction");
                        ptStartAction.Value = prjStartAction.prjStartActionURL;

                        EnvDTE.Property ptStartUrl = configuration.Properties.Item("StartUrl");
                        ptStartUrl.Value = "http://MyServer/MyURL";
                    }
                }
            }


    But, when I look at  my Project Properties in Visual Studio, the project properties are not set.

    Any idea would be greatly appreciated.

    Regards,

    Nico
    Friday, December 5, 2008 8:43 AM

Answers

  • Yeah, it's a little tricky with web applications. Try this:

    Project.Properties.Item("WebApplication.StartPageUrl").Value = "StartUrl";

    • Proposed as answer by Bob Egan Monday, December 8, 2008 1:27 PM
    • Marked as answer by Rong-Chun Zhang Wednesday, December 10, 2008 9:30 AM
    Monday, December 8, 2008 1:27 PM

All replies

  • Read How to ask questions to increase your chances of an answer and see if you can post sufficient information to reproduce this issue.
    Return to the source, learn the way!
    Friday, December 5, 2008 1:21 PM
  • Yeah, it's a little tricky with web applications. Try this:

    Project.Properties.Item("WebApplication.StartPageUrl").Value = "StartUrl";

    • Proposed as answer by Bob Egan Monday, December 8, 2008 1:27 PM
    • Marked as answer by Rong-Chun Zhang Wednesday, December 10, 2008 9:30 AM
    Monday, December 8, 2008 1:27 PM
  • Hi Bob,

    Thanks a lot for your answer.

    I have set the following properties: WebApplication.DebugStartAction, WebApplication.StartExternalUrl, WebApplication.UseIIS, WebApplication.IISUrl, and it works fine.

    My mistake was to search on the Configuration Properties list, not in the Project Properties list.

    Nicolas
    Tuesday, December 16, 2008 8:32 AM