-
Notifications
You must be signed in to change notification settings - Fork 16
Precompiled views don't work for relative paths #231
Comments
@pranavkm, what is the expected behavior here? |
Expected: dotnet publish -r win7-x64 should yield *.PrecompiledViews.dll and no refs folder. |
We specifically disabled precompilation for self contained apps in 2.0. #102 (comment) has some guidance on what you could do workaround this. The issue is addressed as part of 2.1.0-preview1 release. |
That workaround definitely does not work. Excluding the views and providing *.PrecompiledViews.dll just results in "View not found" being spammed to the log file. |
Do you have a repro app for this? We've been recommending the copying behavior for a while now and it's worked for most users. |
I have an application that reliably reproduces it but I can't publish it here. At this point our team plan is to try the 2.1 version of .NET Core (which will take some effort) before we see if we can reduce this out. I was able to try the workaround quickly because it merely involved copying a few files around. |
@pranavkm : I couldn't find an official preview release, and the nightly builds currently ship with an MVC Razor that doesn't work. I filed the bug in core itself because the template mvc project doesn't work. dotnet/core#1221 |
@jhudsoncedaron, unfortunately we won't be able to help you without a repro. If you could share with us a minimalistic repro project, with all the "sensitive" stuff stripped out, that would be great. |
@jhudsoncedaron the issue is a runtime issue. Updating to the most recent |
I'm sorry. I don't actually understand razor views very well and am blundering around. I have successfully determined the following: The workaround doesn't work when the view references another view with '..' in the reference path. |
@jhudsoncedaron when you say reference, is this when you're attempting to do something along the lines of |
I constructed a (silly) reproduction from the empty template using Html.Partial. build project with Run with Open http://localhost:5000; see that the page loads.
Open http://localhost:5000/T2; see that the page loads. |
Thanks @jhudsoncedaron. I'll have a look. |
I tried it on the nightly builds but ASP .NET nightly builds are still broken as of today's build 2.2.0-previwe1-007947 retrieved from https://github.com/dotnet/cli/blob/master/README.md |
@jhudsoncedaron, the issue is fixed in 2.1.0-preview1. Here's the change to your csproj you can use to verify the change: // emptymvc20.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RestoreSources>https://api.nuget.org/v3/index.json;https://dotnet.myget.org/f/aspnetcore-dev/api/v3/index.json</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.1.0-preview1-28137" />
</ItemGroup>
</Project> For the 2.0 release, here's some past discussion around this area: aspnet/Mvc#6672 (comment). Tl;dr: use |
Dup of aspnet/Mvc#6672 |
On running
dotnet publish
I get a *.PrecompiledViews.dll and no refs folder.On running
dotnet publish -r win7-x64
I get no *.PrecopmiledViews.dll and a refs folder.I tried copying the *.PrecompiledViews.dll from one to the other but it didn't work.
The text was updated successfully, but these errors were encountered: