I'm upgrading a project and a library with embedded views to .NET Core 2.0.0 and seem to have lost precompilation. I've simplified the csproj files down to their bare bones, and the docs suggest that I should gain precompilation out of the box:
All the ASP.NET Core 2.x project templates set MvcRazorCompileOnPublish to true.
My first publish after the upgrade has removed the live Project.PrecompiledViews.dll and uploaded all the cshtml files that weren't present on 1.1.1. I've tried manually setting MvcRazorCompileOnPublish to true on both the project and the library, but that doesn't have any impact. I've tried manually removing cshtml files from the publish with <Content Update="**\*.cshtml" CopyToPublishDirectory="Never" /> and republishing, but that leaves the application inoperable.
The csproj for the class library:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Build">
<TargetFramework>netcoreapp2.0</TargetFramework>
<OutputType>Library</OutputType>
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
</PropertyGroup>
<PropertyGroup Label="Assembly">
<AssemblyName>Library</AssemblyName>
<PackageId>Library</PackageId>
<Product>Library</Product>
<Authors>Test</Authors>
<Company>Test</Company>
<Description>Library</Description>
<Copyright>Copyright © 2016 - 2017 Test</Copyright>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
</PropertyGroup>
<ItemGroup Label="Embedded Resources">
<EmbeddedResource Include="Views\**\*.cshtml" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
</Project>
And the csproj for the project itself:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Build">
<TargetFramework>netcoreapp2.0</TargetFramework>
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
</PropertyGroup>
<PropertyGroup Label="Assembly">
<AssemblyName>Project</AssemblyName>
<PackageId>Project</PackageId>
<Product>Project</Product>
<Authors>Test</Authors>
<Company>Test</Company>
<Description>Project</Description>
<Copyright>Copyright © 2009 - 2017 Test</Copyright>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
</PropertyGroup>
<ItemGroup Label="Remove From Publish Output">
<Content Update="Typescript\**\*" CopyToPublishDirectory="Never" />
<Content Update="**\*.map" CopyToPublishDirectory="Never" />
<Content Update="**\*.md" CopyToPublishDirectory="Never" />
<Content Update="**\*.css" CopyToPublishDirectory="Never" />
<Content Update="**\*.js" CopyToPublishDirectory="Never" />
</ItemGroup>
<ItemGroup Label="Add Minified Files Back Into Publish Output">
<Content Update="**\*.min.css" CopyToPublishDirectory="PreserveNewest" />
<Content Update="**\*.min.js" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\Library\Library.csproj" />
</ItemGroup>
<ItemGroup Label="Package References">
</ItemGroup>
<ItemGroup Label="Tool References">
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" />
</ItemGroup>
</Project>
The project is currently hosted on Azure. Have things changed and there is no longer a DLL for the views and the cshtml files should be present on the server? Is there any way to test whether a view being served is precompiled or not? It certainly doesn't feel precompiled at present, with an obvious delay on the first run of each view.
What is the minimum required to get this working? I've looked through some of the testapps in this repo, but there seems to be a lot going on in some of them which I assume shouldn't be necessary when not running tests.
I'm upgrading a project and a library with embedded views to .NET Core 2.0.0 and seem to have lost precompilation. I've simplified the csproj files down to their bare bones, and the docs suggest that I should gain precompilation out of the box:
My first publish after the upgrade has removed the live Project.PrecompiledViews.dll and uploaded all the cshtml files that weren't present on 1.1.1. I've tried manually setting
MvcRazorCompileOnPublishto true on both the project and the library, but that doesn't have any impact. I've tried manually removing cshtml files from the publish with<Content Update="**\*.cshtml" CopyToPublishDirectory="Never" />and republishing, but that leaves the application inoperable.The csproj for the class library:
And the csproj for the project itself:
The project is currently hosted on Azure. Have things changed and there is no longer a DLL for the views and the cshtml files should be present on the server? Is there any way to test whether a view being served is precompiled or not? It certainly doesn't feel precompiled at present, with an obvious delay on the first run of each view.
What is the minimum required to get this working? I've looked through some of the testapps in this repo, but there seems to be a lot going on in some of them which I assume shouldn't be necessary when not running tests.