Can you deploy single aspx.cs file using Visual Studio Web Publish to Azure Web App (Azure runtime issue)

I’ve noticed that although I’m able to successfully deploy my web app (ASP.NET) to Azure using web publish in Visual Studio. I’m also able to successfully deploy individual files to the server directory, by right clicking on the file in the solution explorer and clicking publish.

However, changes to the code behind don’t seem to run on the server without publishing the entire solution. Changes to the HTML/CSS etc are updated and become effective immediately, and the C# code is making it to the server successfully, but the server continues to run the previous code.

I have tried restarting the app in azure, and I’ve added the rules to prevent server caching.

Is there anything that a full web-publish does that the publishing of individual files doesn’t do?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Changes to your code (.cs files) are compiled into a code library file. This file is saved into the bin folder and will be named like your project, for example yourprojectname.dll. This is all done by Visual Studio.

For the changes in your code behind files to work, you need to publish the respective dll files to your host.

If you publish the project then the required dll files will also be included, so your changes will work.

Additionally;

You don’t really want to publish your cs files at all. These are source code and aren’t needed by the host server for your application to function. cs files should be checked into your version control system (i.e. GitHub repository)


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x