0
votes

I'm developing a .Net MVC application that was working and I decided to move it to another location. I thought that was only necessary to create a new Azure Web App to my desired location and redeploy it.

Now I'm having this compilation problem in Azure, something related to .Net, Roslyn and Bundling. Since this is working locally, I can't understand what is going on in Azure, since the same application was working before.

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'Styles' does not exist in the current context

Source Error:

Line 12: Line 13: Line 14: @Styles.Render("~/Style/css") Line 15:
@Scripts.Render("~/bundles/modernizr") Line 16:

Source File: D:\home\site\wwwroot\Views\Home\Index.cshtml Line: 14

Show Detailed Compiler Output:

D:\Windows\system32>D:\home\site\wwwroot\bin\roslyn\csc.exe /t:library /utf8output /nostdlib+ /R:"D:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Spatial\v4.0_5.6.0.0__31bf3856ad364e35\System.Spatial.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\8dd4b585\0084c935_f2abd201\Newtonsoft.Json.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\6abdb48c\005510f3_c30ad201\CsvHelper.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\a0941bb4\001a1086_d374d301\Google.Apis.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\1af2ad0e\005ef952_9470d101\FluentValidation.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Data.OData\v4.0_5.6.0.0__31bf3856ad364e35\Microsoft.Data.OData.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\a250eafb\008fd90f_a047d001\Microsoft.Owin.Security.Google.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\67e7d96a\00cbe48c_01bfce01\System.Web.Cors.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\3c70c164\00e93b12_a047d001\Microsoft.Owin.Security.Twitter.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\e4dac2ae\00699ff0_e454d001\EntityFramework.SqlServer.dll" /R:"D:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\dcccdd86\008c1401_c03ad001\System.Web.Razor.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\edff15bb\09a087ea_95b1d301\Fosfato.DAL.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\725eebfa\006a4e1b_c03ad001\System.Web.Http.Owin.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\43645639\00442dc2_2883ce01\WebGrease.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\ed43cb3f\001f6ee7_a9c1cd01\Owin.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\83511cf4\008fd90f_a047d001\Microsoft.Owin.Security.Facebook.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\f62de24b\00eb6947_c03ad001\System.Web.WebPages.Razor.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\de96b498\004bb24d_f545d201\AutoMapper.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\d30f028b\0035770d_a047d001\Microsoft.Owin.Host.SystemWeb.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\20dd3aa2\00c2670b_2c06ce01\WebActivatorEx.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\39d0ee44\0c1fc9e8_95b1d301\Fosfato.Model.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\App_global.asax.pnwttmhi.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\e30d7751\00f1bde1_9050d201\Microsoft.AI.WindowsServer.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\e8214ff4\00f31dc2_b678d301\Google.Apis.Admin.Directory.directory_v1.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\2fc11bef\0008460c_a047d001\Microsoft.Owin.Cors.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Data.Edm\v4.0_5.6.0.0__31bf3856ad364e35\Microsoft.Data.Edm.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\6b410bfd\007986cb_496ed001\Microsoft.AspNet.Identity.Core.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\b11ea9c6\00bebbdb_f110ce01\Antlr3.Runtime.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\EnvSettings\v4.0_1.0.0.0__31bf3856ad364e35\EnvSettings.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\9222b4e7\00f1bde1_9050d201\Microsoft.AI.PerfCounterCollector.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\676a5504\000d302d_c03ad001\System.Web.Http.WebHost.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\f3319e17\008facaf_9050d201\Microsoft.AI.Web.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\7eaae1a3\00474187_d374d301\Google.Apis.Auth.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\6e9ac074\007a0b63_e44fd201\Microsoft.AI.ServerTelemetryChannel.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\3bb80d16\00ae5a5a_3af3d101\Autofac.Integration.Mvc.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\23f96e88\007986cb_496ed001\Microsoft.AspNet.Identity.Owin.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\2fa1cf20\00aba7a4_344bd201\Microsoft.AI.Agent.Intercept.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\50b185a8\00de2457_4e27cf01\System.Web.Optimization.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\48445bd8\0051bcf8_bf3ad001\System.Web.Mvc.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\8b69986b\4ed6ceea_95b1d301\Fosfato.Services.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\406fe7b4\002435e6_6d68cf01\Microsoft.Practices.ServiceLocation.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\e444ae7c\008fd90f_a047d001\Microsoft.Owin.Security.Cookies.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\945ea1e5\0047b233_9050d201\Microsoft.AI.DependencyCollector.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\b59a9fa2\00eb6947_c03ad001\System.Web.WebPages.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\6c6bec43\00699ff0_e454d001\EntityFramework.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\1818cb3b\0050f1cc_f045d201\Autofac.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\7eec81a6\007986cb_496ed001\Microsoft.AspNet.Identity.EntityFramework.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\55248759\00db140b_a047d001\Microsoft.Owin.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\b35c4f05\0062a80e_a047d001\Microsoft.Owin.Security.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\2f6b4d9b\00474187_d374d301\Google.Apis.Auth.PlatformServices.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\9ca89816\9b73b6e8_95b1d301\Fosfato.Contracts.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\9213459a\0039eb44_24e2cf01\System.Web.Http.OData.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\f2d823c2\00bc0a11_a047d001\Microsoft.Owin.Security.OAuth.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\4c5b1c32\00eb6947_c03ad001\System.Web.WebPages.Deployment.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\46112478\00d88c4c_e115d301\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\70abe86e\00664b81_d374d301\Google.Apis.Core.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\74cc5da7\001a1086_d374d301\Google.Apis.PlatformServices.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\5539c1f4\00bc0a11_a047d001\Microsoft.Owin.Security.MicrosoftAccount.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\98fb3c67\006d0a07_c03ad001\System.Net.Http.Formatting.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\16c3389d\00eb6947_c03ad001\System.Web.Helpers.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\c882aaeb\007b310e_c03ad001\System.Web.Http.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\701c144b\008a6d17_032ed201\Autofac.Integration.WebApi.dll" /R:"D:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\bc61b0f8\6a6ae284_beb1d301\Fosfato.WebUI.dll" /R:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\assembly\dl3\199ae633\0030da8e_e34fd201\Microsoft.ApplicationInsights.dll" /out:"D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\App_Web_index.cshtml.a8d08dba.ab2w5knm.dll" /D:DEBUG /debug+ /optimize- /warnaserror- /w:4 /nowarn:1659;1699;1701;612;618 /langversion:6 /nowarn:1659;1699;1701 "D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\App_Web_index.cshtml.a8d08dba.ab2w5knm.0.cs" "D:\local\Temporary ASP.NET Files\root\1c975cd9\ad0507d5\App_Web_index.cshtml.a8d08dba.ab2w5knm.1.cs"

Microsoft (R) Visual C# Compiler version 2.3.0.61908 (281ac90b) Copyright (C) Microsoft Corporation. All rights reserved.

D:\home\site\wwwroot\Views\Home\Index.cshtml(14,10): error CS0103: The name 'Styles' does not exist in the current context D:\home\site\wwwroot\Views\Home\Index.cshtml(15,10): error CS0103: The name 'Scripts' does not exist in the current context D:\home\site\wwwroot\Views\Home\Index.cshtml(34,10): error CS0103: The name 'Scripts' does not exist in the current context D:\home\site\wwwroot\Views\Home\Index.cshtml(35,10): error CS0103: The name 'Scripts' does not exist in the current context D:\home\site\wwwroot\Views\Home\Index.cshtml(36,10): error CS0103: The name 'Scripts' does not exist in the current context

The Azure Application Insights does not help much, returnig the same message:

01/03/2018 17:57:07 D:\home\site\wwwroot\Views\Home\Index.cshtml(14): error CS0103: The name 'Styles' does not exist in the current context Problem Id:System.Web.HttpCompileException at System.Web.Compilation.AssemblyBuilder.Compile

1
Have you tried to download the whole content from the old website content with kudu tool and upload to the new website? You also create a new webapp for test. If you use VS for publishing please make sure that it could work on locally.Tom Sun - MSFT
Unfortunatelly I was so sure that it would work in the new location and since I wanted to use the same address, I deleted the old one before having the new working. And yes, It is working locally.Sergio Ramos

1 Answers

0
votes

Solved.

After reviewing every step I took after making the first successful deployment to Azure, I discovered that one config file was not part of the Solution anymore, the Web.config file under the Scripts > View folder, that had an include of the System.Web.Optimization library.

Since the routing is now done by the AngularJS router, I didn't realize that I still needed this MVC Razor piece and I decided to remove it from the solution. Locally it works, but since that config was not in Azure I got the error.

Now the config is back, not needed locally but to run in Azure.