I'm using Aspnetboilerplate framework in my Web project.
Everything was working until I noticed that my production environment was very slow on first page access.
Doing some researchs I discovered that the problem was to not pre compile cshtml views on build. So, in my vsts build definition I added the follow:
/p:PrecompileBeforePublish=true /p:UseMerge=true /p:SingleAssemblyName=AppCode
But now I'm getting the follow error on all my cshtml views:
Seduca.Web\obj\Release\AspnetCompileMerge\Source\App\Main\views\aulas\index.cshtml(5,0): Error CS0103: The name 'IsGranted' does not exist in the current context
Works if I put this on top of each view:
but it looks like my file (web.config) is being ignored.
My .csproj looks like this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<ExtraWebConfigs Include="$(BaseIntermediateOutputPath)\**\web.config" />
<ExtraPackageTmp Include="$([System.IO.Directory]::GetDirectories("$(BaseIntermediateOutputPath)", "PackageTmp", System.IO.SearchOption.AllDirectories))" />
<Delete Files="@(ExtraWebConfigs)" />
<RemoveDir Directories="@(ExtraPackageTmp)" />
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
And the web.config:
The error only happens in vsts build. In local deploy, (with release option and precompile) it works.
I've tried with hosted and private agents on vsts.