none
Visual Studio Community 2015 Update 2 - set start page as index.html

    Question

  • I just upgraded to Visual Studio Community 2015 Upgrade 2. I am trying to use VS to develop a simple web site with index.html in the wwwroot folder and one, simple JS file. 

    While I can open File Explorer to open by index.html page in a browser, I have no clue how to start at index.html through VS. Old versions of VS allowed me to set the start page, but after lots of clicking around, I couldn't get this very basic thing. Any hints or links on how to do this?

    This seems so basic, and I spent several hours trying different types of sites when setting up a project, reading docs, and not finding a solution. Learning C# and MVC ... sorry for the dumb question.

    Sunday, June 05, 2016 7:58 PM

Answers

  • Hi RidgeRunner22,

    If you are making simple web site just html and js... and you want to run it and open in browser. If this is what you want than I suggest you to go with this steps:

    1. File -> New -> Web Site

    2. ASP.NET Empty Web Site

    3. Open Solution Explorer and than delete packages.config and Web.config files

    4. Add new HTML page name it as index.html

    5. Right click on your index.html and click on Set As Start Page 

    6. You can go with CTRL + F5 and your web site will be opened in browser... if you go with F5 it will tell you that you dont have web.config and that you can run it without debugging..

    And also add something to your index.html page so that it is not blank when browser opens it something like this:

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    	<meta charset="utf-8" />
    </head>
    <body>
         <h2> Hello World </h2>
    </body>
    </html>

    Hope this was helpful for you...

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)


    Sunday, June 05, 2016 8:30 PM

All replies

  • Hi RidgeRunner22,

    If you are making simple web site just html and js... and you want to run it and open in browser. If this is what you want than I suggest you to go with this steps:

    1. File -> New -> Web Site

    2. ASP.NET Empty Web Site

    3. Open Solution Explorer and than delete packages.config and Web.config files

    4. Add new HTML page name it as index.html

    5. Right click on your index.html and click on Set As Start Page 

    6. You can go with CTRL + F5 and your web site will be opened in browser... if you go with F5 it will tell you that you dont have web.config and that you can run it without debugging..

    And also add something to your index.html page so that it is not blank when browser opens it something like this:

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    	<meta charset="utf-8" />
    </head>
    <body>
         <h2> Hello World </h2>
    </body>
    </html>

    Hope this was helpful for you...

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)


    Sunday, June 05, 2016 8:30 PM
  • Hi Almir,

    Thanks for your response - and I wish this worked, but no luck. Below is the menu I get when I right click on the index.html file - and there is no "set as start page" on the menu. See image below of my choices.

    I used to be able to start this in VS Community Update 1, but since I upgraded, I keep getting errors. I think it is looking for the Startup.cs file. I cannot debug at all (greyed out selection) unless there is a Startup.cs file.

    The Startup.cs file is much different from the Update 1 version. I am not good at C#, but here it is:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNet.Builder;
    using Microsoft.AspNet.Hosting;
    using Microsoft.AspNet.Http;
    using Microsoft.Extensions.DependencyInjection;
    
    namespace TestAccordionEmptyWeb
    {
        public class Startup
        {
            // This method gets called by the runtime. Use this method to add services to the container.
            // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
            public void ConfigureServices(IServiceCollection services)
            {
            }
    
            // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
            public void Configure(IApplicationBuilder app)
            {
                app.UseIISPlatformHandler();
    
                app.Run(async (context) =>
                {
                    await context.Response.WriteAsync("Hello World!");
                });
            }
    
            // Entry point for the application.
            public static void Main(string[] args) => WebApplication.Run<Startup>(args);
        }
    }
    

    It has a main method here (and I get an error if I don't have that). It runs and displays the message "hello world." I have no clue how to change this to display my index.html page and the navigation now seems to be the MVC controller-action-ID URLs. In other words, I can't just put in "index.html" in the browser to  display the page.

    When I look at one of my older (AngularJS) projects, the default Startup.cs file is significantly different and it works in the old project but not in this new test project. See below for startup.cs:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNet.Builder;
    using Microsoft.AspNet.Http;
    using Microsoft.Framework.DependencyInjection;
    
    
    namespace votm3
    {
        public class Startup
        {
            public void ConfigureServices(IServiceCollection services)
            {
                services.AddMvc();
            }
    
            public void Configure(IApplicationBuilder app)
            {
                app.UseMvc();
                app.UseDefaultFiles();
                app.UseStaticFiles();
            }
        }
    }
    

    With this new Update 2, there must be other stuff going on that I don't know about and I have no clue how to fix. Any help would be most appreciated.

    Deborah

    Monday, June 06, 2016 2:41 PM
  • Hi RidgeRunner22,

    My question for you is... do you want to make simple web site/app with html css and js or you want to make ASP.NET MVC web app and you have this kind of problem?

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)

    Monday, June 06, 2016 2:49 PM
  • I have tried all options. This is what happens with the simplest Visual C#>ASP.NET Web Application>ASP.NET 5 Templates>Empty.

    For now, I just want a simple web site/app with html and CSS to test a simple Angular App. After that, I will be trying to integrate MVC and Angular with the funky routing process between MVC and Angular.

    Monday, June 06, 2016 2:56 PM
  • Hi RidgeRunner22,

    In that case you are not following me as I wrote you in first my reply...

    I said to you to create New Web Site not ASP.NET Application

    File -> New -> Web Site

    I will paste here an image how you can do first step and that you can follow my fist replay and finish task that you want to accomplish


    And than you can go with steps that I wrote in my first answer/reply...

    If this was helpful for you please mark as an answer my first reply so it can be helpful for others.

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)

    • Marked as answer by RidgeRunner22 Monday, June 06, 2016 4:21 PM
    • Unmarked as answer by RidgeRunner22 Monday, June 06, 2016 4:57 PM
    Monday, June 06, 2016 4:09 PM
  • Thank you SOO much. I never even saw the File>New>Website and just passed right over this to always go to File>New>Project. Silly me ... wish I knew this sooner, it would have saved lots of trouble over the past months.
    Monday, June 06, 2016 4:23 PM
  • Thank you SOO much. I never even saw the File>New>Website and just passed right over this to always go to File>New>Project. Silly me ... wish I knew this sooner, it would have saved lots of trouble over the past months.

    Hi RidgeRunner22,

    I am so glad that you solved your problem by my help... and thank you for marked answer but It will be more helpful if you mark my first reply because it contains full steps to solve this particular task.

    Best luck with programming and developing!

    Best regards!


    (If this was helpful for you, vote for it and propose it as an answer)

    Monday, June 06, 2016 4:53 PM