Aspx.cs files not geting deployed on azure

Haris Ehsan 1 Reputation point
2021-06-21T11:22:22.263+00:00

My aspx.cs and designer files do not get published on azure. when i view the files on azure i cannot see the aspx.cs and designer files. cant understand the reason behind

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,249 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,853 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 47,806 Reputation points
    2021-06-21T14:36:58.627+00:00

    They are source files, they shouldn't be deployed. The only thing that gets deployed when you publish a web app are the content files (images, scripts, etc), config files, binaries and HTML (cshtml, html, etc). The source files are compiled into the DLL that goes into the bin folder. They aren't needed when the site is running.

    0 comments No comments

  2. ajkuma 22,241 Reputation points Microsoft Employee
    2021-06-29T12:09:45.773+00:00

    @Haris Ehsan ,

    Adding to cooldadtx suggestions.

    Since you have posted the question on azure-webapps tag, I presume you're leveraging Azure App Service WebApps.

    Just to highlight, Azure offers several ways to host websites: Azure App Service WebApps (PAAS solution), Virtual Machines (IAAS), Service Fabric and Cloud Services, etc. On an Azure Virtual Machine, hosting a website is just similar to what you do on prem.

    On App Service, the deployment pretty much does only one thing: it deploys files into the wwwroot folder.manually copy some files over using Kudu Console.
    You may access Kudu Console (https://<yourwebpp-name>.scm.azurewebsites.net/) [Debug console>cmd] and review the site root/ d:\home\site\wwwroot\ ]

    As cooldadtx mentioned, it's due to the source files compiled into the DLL (lands on bin folder).

    Also see this example - All of the .cs files, including .aspx.cs, .aspx.designer.cs, Master.cs, and Master.designer.cs files are omitted. All of this code has been compiled into the ContosoUniversity.dll and ContosoUniversity.pdb files that you'll find in the bin folder. Because only the .dll is needed to run the application, and you specified earlier that only files needed to run the application should be deployed, no .cs files were copied to the destination environment. The obj folder and the ContosoUniversity.csproj and .csproj.user files are omitted for the same reason.

    Typically, it's the same framework behavior on Azure as well. On a flip side, if an app doesn't work locally, it mostly never works on Azure as well.

    -----------------------------------------------------------------------------------------------------------------------

    To benefit the community, find the right answers, please do mark the post which was helpful by clicking on ‘Accept Answer’ & ‘Up-Vote’.

    0 comments No comments