g.pickardou
g.pickardou

Reputation: 35883

How to publish (deploy) .lic file to the root of an Azure Web App Service?

Problem

A .lic file which is in the root of the ASP.NET Web Application is not deployed to Azure Web App during VS 2015 Publish operation. The .lic file set as "Content"

Context

I have a component in my ASP.NET MVC which requires its .lic file in the web application root. I am using VS 2015 Built in Publish to deploy my web app to Azure as an Azure Web App Service. The .lic file is added to the ASP.NET MVC Web project as a "Content". However the .lic file is not published. (checked via FTP)

Question

How can I publish this .lic file to the Web App Service root? (of course I can manually copy it via ftp, but that's not a solution in long term)

More Diagnostics

I've created a Hello.txt file in my project in the root. All settings the same, the Hello.txt is published. It seems that the VS 2015 Publish ignores .lic files... Is it possible? How to overcome?

Upvotes: 5

Views: 1192

Answers (1)

Der_Meister
Der_Meister

Reputation: 5027

Add to web.config:

<system.web>
  <compilation>
    <buildProviders>
      <remove extension=".lic"/>
      <add extension=".lic" type="System.Web.Compilation.ForceCopyBuildProvider"/>
    </buildProviders>
  </compilation>
</system.web>

Background

There are a few files, that are getting ignored by default because of the buildProviders configuration. (e.g. .lic, .licx, .exclude, .refresh)

As an example the buildProviders section of a .NET Framework 4.8 installation on x64 from "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config":

<buildProviders>
    <add extension=".aspx" type="System.Web.Compilation.PageBuildProvider"/>
    <add extension=".ascx" type="System.Web.Compilation.UserControlBuildProvider"/>
    <add extension=".master" type="System.Web.Compilation.MasterPageBuildProvider"/>
    <add extension=".asmx" type="System.Web.Compilation.WebServiceBuildProvider"/>
    <add extension=".ashx" type="System.Web.Compilation.WebHandlerBuildProvider"/>
    <add extension=".soap" type="System.Web.Compilation.WebServiceBuildProvider"/>
    <add extension=".resx" type="System.Web.Compilation.ResXBuildProvider"/>
    <add extension=".resources" type="System.Web.Compilation.ResourcesBuildProvider"/>
    <add extension=".wsdl" type="System.Web.Compilation.WsdlBuildProvider"/>
    <add extension=".xsd" type="System.Web.Compilation.XsdBuildProvider"/>
    <add extension=".js" type="System.Web.Compilation.ForceCopyBuildProvider"/>
    <add extension=".lic" type="System.Web.Compilation.IgnoreFileBuildProvider"/>
    <add extension=".licx" type="System.Web.Compilation.IgnoreFileBuildProvider"/>
    <add extension=".exclude" type="System.Web.Compilation.IgnoreFileBuildProvider"/>
    <add extension=".refresh" type="System.Web.Compilation.IgnoreFileBuildProvider"/>
    <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider"/>
    <add extension=".xoml" type="System.ServiceModel.Activation.WorkflowServiceBuildProvider, System.WorkflowServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add extension=".svc" type="System.ServiceModel.Activation.ServiceBuildProvider, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    <add extension=".xamlx" type="System.Xaml.Hosting.XamlBuildProvider, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</buildProviders>

Upvotes: 1

Related Questions