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

AddRazorSupportForMvc in RCL stops runtime compilation but without it no partial views are published on Release #42629

Open
1 task done
flatproject opened this issue Jul 8, 2022 · 3 comments
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-runtime-compilation investigate
Milestone

Comments

@flatproject
Copy link

flatproject commented Jul 8, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When the setting AddRazorSupportForMvc is added to an RCL like below it stops the runtime compilation from working. If it is removed then no partial views are published on Release.

This is my RCL:

<Project Sdk="Microsoft.NET.Sdk.Razor">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
      <AddRazorSupportForMvc>True</AddRazorSupportForMvc>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>
</Project>

This is how I add runtime compilation in the Startup file of the project that references the RCL:

if (HostingEnvironment.IsDevelopment())
            {
                services
                    .AddRazorPages()
                    .AddRazorRuntimeCompilation(options =>
                    {
                        var libPath = Path.GetFullPath(Path.Combine(HostingEnvironment.ContentRootPath, "..", "Test.ReportsLibrary"));
                        options.FileProviders.Add(new PhysicalFileProvider(libPath));
                    });
            }

This is how my launchSettings.json looks like:

"IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
      }
    },

Expected Behavior

I would have expected either adding the AddRazorSupportForMvc setting not to break the runtime compilation OR if the setting was not available my RCL partial views to get published when I do a release.

Steps To Reproduce

https://github.com/flatproject/AddRazorSupportForMvc

Enable the AddRazorSupportForMvc setting in the RCL and try to edit the Index1.cshtml page in the RCL and refresh to see your change. It will not work.

Disable the AddRazorSupportForMvc setting in the RCL and do a production release. The partial view is not published.

Exceptions (if any)

No response

.NET Version

6.0.301

Anything else?

Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.2.5

`C:\WINDOWS\system32>dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.301
Commit: 43f9b18481

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.301\

Host (useful for support):
Version: 6.0.6
Commit: 7cca709db2

.NET SDKs installed:
6.0.301 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]`

@javiercn javiercn added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-runtime-compilation labels Jul 8, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 8 Planning milestone Jul 11, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 8 Planning, Backlog Oct 25, 2022
@ghost
Copy link

ghost commented Oct 25, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@khayes
Copy link

khayes commented Jan 1, 2023

I just wasted a huge amount of time trying to troubleshoot why Razor runtime compilation was not working for a Razor class library. Then I stumbled on this issue and found its the exact problem I have.

The documentation around this is frustrating because it implies it is very simple. Yet it doesn't actually work, and having to dig into the guts of MSBuild properties and GitHub issues around this is painful.

@aloksharma1
Copy link

aloksharma1 commented Aug 15, 2023

I have a similar issue like this, my RCL library is referenced to main project which hosts the services and runtime compilation, the rcl library works for most part except the partial view after 17 hours nonstop digging i came here to drop an issue and saw this, and this was something that was working ok in .net 5 which made me assume that some setting was changed and i was doing something wrong with newer dotnet version oblivious to the bug. Guess i can only remove all partial views from common UI library :( ironic how something already working gets break with newer-better version.

ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Nov 4, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Nov 4, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/IdentityManager2 that referenced this issue Nov 4, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 4, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Nov 9, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Nov 9, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 9, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Nov 16, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 16, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 18, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Nov 20, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Nov 20, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 20, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Nov 23, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 23, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Nov 29, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Nov 29, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Nov 29, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Dec 1, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 1, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 8, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Dec 13, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Dec 13, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 13, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 15, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 16, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 20, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Dec 25, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Dec 25, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 25, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Dec 31, 2023
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Jan 2, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 2, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 3, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 4, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 4, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Jan 8, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Caching-MySQL that referenced this issue Jan 8, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 8, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Jan 9, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 9, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 10, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/InkBall that referenced this issue Jan 12, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
ChaosEngine added a commit to ChaosEngine/Dotnet-Playground that referenced this issue Jan 12, 2024
rc.2 is failing miserably with impossible RCL error (dotnet/aspnetcore#42629) and requirement of some additional package reference to fix. Crazy but rc.1 works. Tests still failing on Inkball SignalR. Weird.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-runtime-compilation investigate
Projects
None yet
Development

No branches or pull requests

5 participants