3

Setup

  • Visual Studio 2015 (with Update 3 and latest hotfix as of today)
  • .NET Core SDK (preview 2) installed
  • Create a new ASP.NET Core project
  • Add a new area, register it and add views in it
  • Deploy it to IIS using web deploy in Visual Studio

Part of my project.json

"publishOptions": {
  "include": [
    "wwwroot",
    "Views",
    "Areas/**/Views",
    "appsettings.json",
    "web.config"
  ]
},

My publish profile

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://somedomain/</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <PublishFramework>netcoreapp1.0</PublishFramework>
    <UsePowerShell>True</UsePowerShell>
    <EnableMSDeployAppOffline>True</EnableMSDeployAppOffline>
    <MSDeployServiceURL>http://someip</MSDeployServiceURL>
    <DeployIisAppPath>sitename</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>RemoteAgent</MSDeployPublishMethod>
    <EnableMSDeployBackup>False</EnableMSDeployBackup>
    <UserName>username</UserName>
    <_SavePWD>True</_SavePWD>
    <PublishDatabaseSettings>
      <Objects xmlns="" />
    </PublishDatabaseSettings>
    <ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
    <AuthType>NTLM</AuthType>
  </PropertyGroup>
</Project>

The problem

After successful deploy the area view are missing from the server. There is no Area folder nor the area's views are located in the Views folder. All other views (outside of areas) are present.

Am I doing something wrong or this problem is known? Does anyone had the same problem and if so what is the solution?

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123

3 Answers3

5

Temporary fix as stated on https://github.com/aspnet/Mvc/issues/4645 is to add

"**/*.cshtml",

in publishOptions.include.

Worked in my case.

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
1

in the project.json file of your web app you need to tell it what to include:

"publishOptions": {
    "include": [
        "wwwroot",
        "Views",
        "Areas/**/Views",
        "appsettings.json",
        "navigation.xml",
        "web.config"
    ]
},
Joe Audette
  • 35,330
  • 11
  • 106
  • 99
1

I have found that webdeploy of ASP.NET applications using VS 2015 Update 3 to Azure does not correctly pick up all necessary files; specifically new Views, new fonts, and new CSS files that I have added to my project.

Manipulating the project Properties >> Package/Publish Web >> [Items to deploy] does not help - these new items are ignored.

Viewing my site and using the Chrome console, I noted the items that were missing, and edited the .csproj file to add the missing items; in my case:

<Content Include="Views\Dashboard\Index.cshtml" />
<Content Include="fonts\glyphicons-halflings-regular.woff" />
<Content Include="Content\jquery-confirm.min.css" />

in the obvious places - eg find other View files and intercalate mine.

I then found that Azure would pretend that *.woff files were missing (404). They were not, so I had to add the following to web.config:

<system.webServer>
    <staticContent>
        <mimeMap fileExtension="woff" mimeType="application/font-woff" />
    </staticContent>
</system.webServer>

Poor show chaps.

jcsubmit
  • 146
  • 2
  • 9