.NET 6 compability seems to be broken or I'm doing something wrong
See original GitHub issueHello,
So I followed the tutorial on how to implement a modal/banner,
My Startup.cs
:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Majorsoft.Blazor.Components.GdprConsent;
namespace _34digital.ruhr
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
//Register dependencies
services.AddGdprConsent();
services.AddRazorPages();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}
}
}
No errors appeared here. But as soon as I add the code for the banner/modal into _Layout.cshtml
or any new shared razor page I get a lot of errors. The most common error type is Name X is not available in current context. Here’s a screenshot of the errors marked.
I am using .NET Core 6 (Blazor) on Visual Studio 2022 Preview 3.1
P.S. yes I’m a beginner at .NET Core and C# in general
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
NET 6 Core Web App Returns web page not found
I've created a mirror project in NET5 in VS2019 with the same port, and it works fine. Trying NET6 from VS 2022 does...
Read more >Breaking changes in .NET 6
This article indicates whether each breaking change is binary compatible or source compatible: Binary compatible - Existing binaries will load ...
Read more >Azure DevOps Pipeline doesn't support .NET 6? (VS2019 ...
NET 6 and wanted to execute a "build, test and publish" pipeline on Azure DevOps. That fails because the hosted agent does not...
Read more >Migrating to .NET 6 : r/dotnet
I'm a person who edits project files by hand and I tend to use imported props files and if you do that it's...
Read more >Cannot debug net6.0-macos Apps - Developer Community
A fix for this issue has been internally implemented and is being prepared for release. We'll update you once it becomes available for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much for answering this so in-depth and even though it was completely not related to your component, I really really appreciate it!
Partially true… When you create a Blazor WASM application (client side) then yes it is true. But Blazor is super flexible it has many hosting models. You can have server side/server hosted Balzor with different render options. Check out render-mode options there is even a “hybrid” where your app renders some HTML to show in the browser (this HTML can have meta tags) and then app will switch to WASM mode.
So Blazor is not a SPA framework as you might think. It is a component based “Web” application framework. And even “WEB” is in quotes since Blazor will be everywhere pretty soon… If not there already… If you write your Blazor components correctly (e.g. no DB or private resource access in the components which will fail on WASM mode) then you can use the SAME components in all apps below:
Even at any point in time you just “port” your application from Server side to WASM or Electron on Mobile with “minimal” effort… Hope this answered your questions.