Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Weird but not Wonderful - .Net Core project discovery

Weird but not Wonderful - .Net Core project discovery

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpdotnethtmlasp-netvisual-studio
8 Posts 4 Posters 45 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR Offline
    realJSOPR Offline
    realJSOP
    wrote on last edited by
    #1

    Using Visual Studio 2019: When I write code for an article, I write the article in an html file that lives in the project itself. As I progress, I eventually want to see what the article looks like in the browser. In .Net Framework projects, this works fine, but in .Net Core projects (in this instance, it was a .Net Core 3.1 project), the menu item "View in browser" does not exist in the context menu for the file. Why would that be?

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    raddevusR G K 3 Replies Last reply
    0
    • realJSOPR realJSOP

      Using Visual Studio 2019: When I write code for an article, I write the article in an html file that lives in the project itself. As I progress, I eventually want to see what the article looks like in the browser. In .Net Framework projects, this works fine, but in .Net Core projects (in this instance, it was a .Net Core 3.1 project), the menu item "View in browser" does not exist in the context menu for the file. Why would that be?

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

      raddevusR Offline
      raddevusR Offline
      raddevus
      wrote on last edited by
      #2

      This is interesting. I created a VStudio 2019 -- ASP.NET Core project. I added a basic.html page to the project in the Views\Home\ folder. I do have the context menu item "View in browser (firefox)". However, when I attempt to load the page it loads the URL in my browser but doesn't display the page (probably due to routing issue). The URL in the browser looks like : http://localhost:49464/Home/basic which is incorrect. It should have the .html. Also I do have UseStaticFiles() in my startup.cs. EDIT I moved the .html file out to the root (not under views) and now I have the context menu item in 2019 and it actually loads the page now. It was a routing issue in the previous attempt.

      realJSOPR 1 Reply Last reply
      0
      • raddevusR raddevus

        This is interesting. I created a VStudio 2019 -- ASP.NET Core project. I added a basic.html page to the project in the Views\Home\ folder. I do have the context menu item "View in browser (firefox)". However, when I attempt to load the page it loads the URL in my browser but doesn't display the page (probably due to routing issue). The URL in the browser looks like : http://localhost:49464/Home/basic which is incorrect. It should have the .html. Also I do have UseStaticFiles() in my startup.cs. EDIT I moved the .html file out to the root (not under views) and now I have the context menu item in 2019 and it actually loads the page now. It was a routing issue in the previous attempt.

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        Mine is a Core 3.1 project. I wonder if that makes a difference...

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        raddevusR 1 Reply Last reply
        0
        • realJSOPR realJSOP

          Mine is a Core 3.1 project. I wonder if that makes a difference...

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

          raddevusR Offline
          raddevusR Offline
          raddevus
          wrote on last edited by
          #4

          Not sure... Here's a snapshot of my Project...[ProjectName] Properties... https://i.stack.imgur.com/gKeTO.png[^] Is this what yours looks like? My project is named WebAppCore

          realJSOPR 1 Reply Last reply
          0
          • raddevusR raddevus

            Not sure... Here's a snapshot of my Project...[ProjectName] Properties... https://i.stack.imgur.com/gKeTO.png[^] Is this what yours looks like? My project is named WebAppCore

            realJSOPR Offline
            realJSOPR Offline
            realJSOP
            wrote on last edited by
            #5

            Mine isn't a web app - it's WPF. EDIT ============ I don't see anything in your settings that's different from mine, excpet mine says "Windows Application" where yours says "Console Application".

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            raddevusR 1 Reply Last reply
            0
            • realJSOPR realJSOP

              Mine isn't a web app - it's WPF. EDIT ============ I don't see anything in your settings that's different from mine, excpet mine says "Windows Application" where yours says "Console Application".

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              raddevusR Offline
              raddevusR Offline
              raddevus
              wrote on last edited by
              #6

              Well, this only took me 24 hours to respond... But anyways, you are correct if it is a WPF app you won't see that context menu. Check this snapshot out -- top of Visual Studio : https://i.stack.imgur.com/ozTUB.png[^] Whether it is wrong or right Studio removes the contextual stuff related to web server and web browser when the app isn't a web project. Compare that first one to this one (which was my previuos web app) See the IIS Express choice at the top ==> https://i.stack.imgur.com/sCewp.png[^] . Not great, but just the way VStudio works I think.

              1 Reply Last reply
              0
              • realJSOPR realJSOP

                Using Visual Studio 2019: When I write code for an article, I write the article in an html file that lives in the project itself. As I progress, I eventually want to see what the article looks like in the browser. In .Net Framework projects, this works fine, but in .Net Core projects (in this instance, it was a .Net Core 3.1 project), the menu item "View in browser" does not exist in the context menu for the file. Why would that be?

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #7

                Does the behavior change if you mark the file "Build action: None", or exclude from project? That might be sufficient to tell Studio to display it using the default browser rather than something dependent on what the rest of the project is doing.

                Software Zen: delete this;

                1 Reply Last reply
                0
                • realJSOPR realJSOP

                  Using Visual Studio 2019: When I write code for an article, I write the article in an html file that lives in the project itself. As I progress, I eventually want to see what the article looks like in the browser. In .Net Framework projects, this works fine, but in .Net Core projects (in this instance, it was a .Net Core 3.1 project), the menu item "View in browser" does not exist in the context menu for the file. Why would that be?

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  K Offline
                  K Offline
                  kapalmuks 3
                  wrote on last edited by
                  #8

                  ..who's fault it is now?.. ..the one who loaded the gun?.. ..or the one who pulled the trigger?.. 🤏🤏🤏🤏

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups