Adding AddRazorRuntimeCompilation() to the container in .NET CORE 6 will break the CSS footer - asp.net-core

I create a brand new ASP.NET Core MVC project using VS 2022 and .NET Core 6.
VS will generate the base template and when I run it without touching any code, everything is fine.
So far so good.
Now I add the NuGet dependency Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation version 6.0.0.
In Program.cs file, I add a line
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddRazorPages().AddRazorRuntimeCompilation(); //Add this line of code
var app = builder.Build();
Rebuild the program and run it. Now I see the footer is not at the bottom of the page anymore.
Is it a bug or did I do something wrong here? Thanks.

I was struggling the same problem as well,
while trying the versions of Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation nuget package and found the solution with 5.0.13 version.
If you downgrade the package from 6.0.1 to 5.0.13, the problem goes away and footer will be on bottom again.

In Visual Studio 2022, there's an option for hot reload on file save. this fixed my issue without having the need to install Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation

What is happening is that when you enable runtime editing, the .NET Core built in bundle and minification is removed. If you look at shared/_layout.cshtml, there is a _layout.cshtml.css file. This is the runtime bundle/include you are missing. Since this is your core layout, move the contents from this file to your wwwroot/css/site.css file and the footer and other elements will render as before.

Is it your intention to actually use RazorPages? It looks like you just want to add runtime compilation to the standard MVC views.
If you intend to use controllers and views, just add:
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
But, I tried your code as well and in my environment, the footer is present in both cases, even if I downgrade Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from version 6.0.1 to 6.0.0.

I think there's no need to add the runtime compilation since in the newest update/version hot-reload has been officially released.
PS. I am currently following an asp.net tutorial and I encountered this problem. Here's the link: https://youtu.be/hZ1DASYd9rk

I'm watching same video series as you do and i had the same error. I upgraded Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation to v6.0.11 and I don't get any error anymore I

Installing Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation version 5.0.17 Nugget Package cleared the error for me.
You may try to install any version from 5.0.0 - 5.0.17

Related

Using Microsoft.EntityFrameworkCore is working when adding package but stops working when running the project

Using Microsoft.EntityFrameworkCore is working when adding a package but stops working when running the project. How I can solve this?
Now it's working:
When I run the project file, it stops working. Again when I build that file, it works again:
Here are my csproj files:
I tried to use SQLite 5.0.1 and design 5.0.1 but they didn't make any change.
Sorry for my bad English :) I hope you can help me.
Right now, your target framework is netstandard2.1. But you are trying to use EntityFrameworkCore 3.1. You can try to upgrade your target framework to 3.1 as follows:
<TargetFramework>netcoreapp3.1</TargetFramework>
You can read more from here.

Web API Help page not showing XML

I have a Web API project in which I removed by hand Areas folder few months ago when we started development. Now after everything is finished I want to add API help pages but it is not working as expected.
I installed nuget package for help pages.
I uncommented line in HelpPageConfig.cs
I checked Generate documentation file (to App_Data folder)
When I open http://localhost:51665/help I get this: (No methods are shown)
Any idea what could be wrong? If I start new project from scratch everything works properly.
I suppose you've setup your project in two steps:
You should choose Build tab in API project Properties and set up XML Documentation file in Output section. For example: App_Data\XmlDocument.xml
Then you can updateHelpPageConfig.cs in method Register... in my case
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
When your project is in compilation process, take a look in output window, whether documentation is really generated.
Try to use older version of ASP.NET Help pages (version 5.2.2 works for me).
Install-Package Microsoft.AspNet.WebApi.HelpPage -Version 5.2.2

Installing KVM Broke Current asp.net vnext Web Project

I installed the KVM using command line and my web project in VS2015 preview broke not compiling, but if add a new web project all works fine, how do uninstall the KVM so I can get my old project working. In this video Scott mention the issue but no solution, please see link, the video mention the issue at the 8:00 minute
video
1: http://channel9.msdn.com/Series/Whats-New-with-ASPNET-5/05 I change the to use the default alias but that did not work
NuGet Settings
I believe your versions are out of sync. Check your project.json and make sure you are not using different versions. I found that when I had 1 dependency that used 3.0.0-* it upgraded to beta2 from beta1. All of my other dependencies had beta1 actually defined. (Ex: 1.0.0-beta1). If the beta2 assembly shares the same dependency as one of your assemblies using beta1 it will override the older version of the shared assembly that is being used and causes your older version to fail.
You can remove any KRE package by deleting it from c:\Users\<user>\.kre\packages\. If you want to remove KRE and KVM then remove both the .kre folder completely.
However, you don't have to remove it to use a different version. You can either use kvm use <version> or, from VS, select the target framework in the project properties.
I have similar issue and I solved it by following steps.
In NUget Package Manager I selected only one nuget.org ( Disable myget.org by unselecting it)
I goto C:\Users\<>.kre\alias directory. Here you will find default.txt and I replace default.txt value with KRE-CLR-x86.1.0.0-beta1 ( If you downloaded latest version of Kre then this file change and it create problem for VS 2015 Preview)
After this close your solution and open it again. If possible then open as Administrator.
I hope this works for you as well.

Worklight 5.0.6 wipes out native customizations in shell

I upgraded my environment to v5.0.6. Problem is that everytime i start Eclipse it does this:
[2013-04-19 18:38:41] FWLST1017I: [AppShell] upgraded to the latest
platform version.
When this upgrade takes place, it reverts my templates and adds class files to the iphone\native folder and removes the plugins I configured in the shell:
Removes all my custom plugins from components/AppShell/iphone/native/Classes
Resets project.pbxproj.wltemplate.wluser to stock removing includes for my classes
Resets config.xml.wluser removing all mappings to my plugins
It also always shows at the end of the upgrade process:
Failed to upgrade Worklight project 'AppMobile' to the latest platform
version. [null]
Is that why it keeps running the upgrade and reverting my changes?
According to your question, you have some .wluser files, which means that something is wrong with your project.
Can you please let me know whether the problem still exists and whether you still have those files in you project?

Dojo version upgrade from 1.3 to 1.7.3

While changing the dojo version from 1.3 to 1.7.3, I simply replaced all my dojo 1.3 folder files with dojo 1.7.3. After rebuilding my web application, I am getting error hxrFailed at dojo.js, line no 15.
What is the wrong that I am facing here? Do I need to change any existing code. Is there any document to refer for all the required changes.
Please help me to get out from this issue.
Thanks,
Sridhar.ch
Lots changed and there are some lengthy tutorials to help you migrate. Check out the documentation tab on Dojo's website:
1.x to 2.0 migration guide:
http://dojotoolkit.org/reference-guide/1.8/releasenotes/migration-2.0.html
Updated buildsystem tutorial:
http://dojotoolkit.org/documentation/tutorials/1.8/build
In theory the current (1.8) build system is backward compatible until 2.0, but in practice I'm not sure it is 100% backward compatible because my 1.6 build profile didn't work with 1.7.x and up. I didn't try that hard to get it to work though.
I have gone through the same. the xhrFailed error occurred for me for multiple reasons. One of the reason was a missing a file in the define as below:
define(["something/was/missing/here"],function(){});.
Another cause for the same error occurred was when a folder in a path of a dependency was renamed but not updated in the application build profile. (This case only if your are doing custom builds).
See if that is the case!