-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Latest OrchardCore packages from Cloudsmith break Razor hot reload #8662
Comments
@sebastienros I've tested all the available CI packages till |
Have you tried with I can't repro the issue on mac, and equally can't test in in Visual Studio. Perhaps paste your |
|
Sorry I meant |
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\Solution.Build.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>$(AssemblyBaseName)</UserSecretsId>
<RootNamespace>$(BaseRootNamespace)</RootNamespace>
<AssemblyName>$(AssemblyBaseName)</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Boxed.AspNetCore" Version="5.1.2" />
<PackageReference Include="Boxed.AspNetCore.TagHelpers" Version="4.0.0" />
<PackageReference Include="DisposableFixer" Version="3.3.0" />
<PackageReference Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ErrorProne.NET.Structs" Version="0.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Flurl" Version="3.0.1" />
<!--<PackageReference Include="LigerShark.WebOptimizer.Core" Version="3.0.295" />-->
<!--<PackageReference Include="LigerShark.WebOptimizer.Sass" Version="3.0.43-beta" />-->
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.16.0" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="$(OrcahrdCoreVersion)" />
<PackageReference Include="OrchardCore.Templates" Version="$(OrcahrdCoreVersion)" />
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.CSharp" Version="1.0.0" />
<PackageReference Include="Syncfusion.EJ2.AspNet.Core" Version="18.4.0.34" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OrchardCore.FavIcon\OrchardCore.FavIcon.csproj" />
<ProjectReference Include="..\SecretCircle.BmwTheme\SecretCircle.BmwTheme.csproj" />
<ProjectReference Include="..\SharpScss\src\SharpScss\SharpScss.csproj" />
<ProjectReference Include="..\WebOptimizer.Sass\src\WebOptimizer.Sass.csproj" />
<ProjectReference Include="..\WebOptimizer\src\WebOptimizer.Core\WebOptimizer.Core.csproj" />
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties properties_4launchsettings_1json__JsonSchema="" />
</VisualStudio>
</ProjectExtensions>
</Project> |
try adding |
@deanmarcussen it indeed helps! Works after adding that setting |
It is only required in an app project. On a theme project, it does not affect anything. |
JT told me that you need to add this property when you have your ASPNETCORE_ENVIRONMENT defined to Production. This should appear in the console when the app starts. When you run your app from VS you should always have Development, and it will allow you to change the razor files dynamically. Otherwise you will need this PreserveCompilationReferences property and it will build all razor files at runtime which will make the app much slower. |
This value is also usually set in the |
But if I run with Ctrl+F5 is still sets the environment to Development. But the Razor hot reload does not work. |
Just tried with Ctrl+F5, it works Having |
Yes, it is. |
Does it mean the |
To have razor runtime compilation you need both
If in production you actually have e.g. That's okay, you can keep |
How does this last comment make sense?
|
Razor runtime compilation needs compilation libraries in the So, to have razor runtime compilation, we need both As i remember, at some point |
Does it mean that the default experience for ASP.NET is to not have runtime compilation, and that if you change a Razor file, even in Development then it doesn't refresh? |
Yes, as i remember, razor runtime compilation is no more the default, and if you want it you now need to reference explicitly the razor compilation package in a given application project Because of our multi tenants structure, we reference this package automatically per tenant, and we register the related services, but only if the |
In VS 2019, while creating new Razor/MVC project, you have a choice to enable "Razor runtime compilation". It can also be enabled by setting env var in launchsettings.json |
Describe the bug
Razor hot reload does not work
To Reproduce
Steps to reproduce the behavior:
But with RC2 packages it works
Expected behavior
Razor hot reload works
The text was updated successfully, but these errors were encountered: