Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dotnet template #141

Open
eskaufel opened this issue Mar 22, 2020 · 2 comments
Open

Update dotnet template #141

eskaufel opened this issue Mar 22, 2020 · 2 comments

Comments

@eskaufel
Copy link

When creating a new project with cli using the MiniBlog template I get an old version (2.0).

@surfmuggle
Copy link
Contributor

surfmuggle commented Oct 17, 2021

I am running into the same issue

Steps i took

  1. In my *.csproj i changed the targetframework to netcoreapp3.1 and try to build /
    1.1. This gave the error Microsoft.AspNetCore.All not supported. Change reference to Microsoft.AspNetCore.App
  2. After adding <PackageReference Include="Microsoft.AspNetCore.App" Version="3.*" /> and removing the reference to All i got error 3
  3. Startup.cs did contain error CS1061: 'IApplicationBuilder' does not contain a definition for 'UseBrowserLink' and no accessible extension method 'UseBrowserLink' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using directive or an assembly reference?) [C:\dev\_dotnetcore\CMS\MiniblogOne\MiniblogOne.csproj].
    And also '"IHostingEnvironment" is obsolete. The recommended alternative is Microsoft.AspNetCore.Hosting.IWebHostEnvironment."
    So i changed the code to this Configure(IApplicationBuilder app, IWebHostEnvironment env)
    Since it is unclear to me what i have to do to replace UseBrowserLink. i removed the following code from Startup.cs
       // IsDevelopment is not supported for Microsoft.AspNetCore.Hosting.IWebHostEnvironment
       if (env.IsDevelopment()) 
       {
           app.UseBrowserLink(); // this is not supported either in .net Core 3.1
           app.UseDeveloperExceptionPage();
       }

  1. The next error was
Microsoft.AspNetCore.Hosting.WebHost[6] Application startup exception
System.InvalidOperationException: 
Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. 
To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false'
 inside 'ConfigureServices(...).

The cause are likely these lines

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

I am puzzled. How much do i have to change to be able to get it to run.

@surfmuggle
Copy link
Contributor

Hallo @eskaufel
have you seen #159 (comment)

I'm` taking pull requests, but not actively working on it myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants