Quantcast
Channel: MSBuild forum
Viewing all articles
Browse latest Browse all 2763

Web Deploy ExcludeFromPackageFolders & ExcludeFoldersFromDeployment both not working for App_Code folder

$
0
0
Hi Build & Deploy Folk,

My Web Deploy from VS 2019 on my Windows 10 dev machine  to IIS on a separate Windows Server machine completes correctly but when it opens the home page of that newly deployed site I get the following error in the browser:

The directory '/App_Code/' is not allowed because the application is precompiled.

Because of this error, I am trying to EXCLUDE '/App_Code/' from my package and/or from my deployment


On docs.microsoft.com there appears to be two conflicting ways to do this:

(1) At https://docs.microsoft.com/en-us/previous-versions/aspnet/ee942158(v=vs.110)  it says to do the following in the .pubxml or the .wpp.targets file

<PropertyGroup">
  <ExcludeFilesFromDeployment>
    File1.aspx;File2.aspx
  </ExcludeFilesFromDeployment>
  <ExcludeFoldersFromDeployment>
    Folder1;Folder2
  </ExcludeFoldersFromDeployment>
</PropertyGroup> 

(2) while at https://docs.microsoft.com/en-us/aspnet/web-forms/overview/deployment/advanced-enterprise-web-deployment/excluding-files-and-folders-from-deployment it says to do the following in the  .wpp.targets file (and I assume this should also work in the appropriate  .pubxml file):

<Project ToolsVersion="4.0" 
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>   
    <ExcludeFromPackageFolders Include="[semi-colon-separated folder list]">
      <FromTarget>[arbitrary metadata value]</FromTarget>
    </ExcludeFromPackageFolders>
    <ExcludeFromPackageFiles Include="[semi-colon-separated file list]">
      <FromTarget>[arbitrary metadata value]</FromTarget>
    </ExcludeFromPackageFiles>
  </ItemGroup>
</Project>

Are these both correct ?  If so which is preferred and why ?

In any case I have tried both in an attempt to NOT deploy my "App_Code" folder and neither appear to work.

Any assistance understanding why the App_Code folder is not being Excluded from the Package or from the Deployment, and how to fix this issue, would be appreciated.

Thanks all

Terry Clancy

ClanceZ

Terry Clancy



Viewing all articles
Browse latest Browse all 2763

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>