Reputation: 685
If this has been asked before, I apologize.
If I had a currently deployed ASP.Net C# website which had a slight bug or modification needed in a cs file, would it be possible to modify the cs file and have IIS recompile the ASP.Net website rather than using Visual Studio or SharpDevelop to rebuild the site?
I'm familiar with PHP websites where a change is compiled automatically. Is there a way to get ASP.Net or IIS to do something similar to the code-behind files of an ASP.Net website?
I understand that modifying the web.config file may force a recompile, and modifying the ASPx files automatically displays the changes, but I haven't found the same success in the code behind files.
Thank you.
Edit (Answer below):
The command to recompile an existing ASP.Net website using existing sources (including the solution file) is this:
%windir%\microsoft.net\framework\v4.0.30319\msbuild /m Solution.sln /p:Configuration=Debug
@IF %ERRORLEVEL% NEQ 0 GOTO err
@exit /B 0
:err
@PAUSE
@exit /B 1
Paste the above code into a batch file within your solution directory. Change the Solution.sln to your solution file, modify the framework to match your installed version. You can change the Configuration option to "Release" as well.
* Batch file code used from SharpDevelop source code. Idea based on this forum post: http://community.sharpdevelop.net/forums/t/8281.aspx
Upvotes: 3
Views: 7262
Reputation: 685
The command to recompile an existing ASP.Net website using existing sources (including the solution file) is this:
%windir%\microsoft.net\framework\v4.0.30319\msbuild /m Solution.sln /p:Configuration=Debug
@IF %ERRORLEVEL% NEQ 0 GOTO err
@exit /B 0
:err
@PAUSE
@exit /B 1
Paste the above code into a batch file within your solution directory. Change the Solution.sln to your solution file, modify the framework to match your installed version. You can change the Configuration option to "Release" as well.
* Batch file code used from SharpDevelop source code. Idea based on this forum post: http://community.sharpdevelop.net/forums/t/8281.aspx
Upvotes: 5
Reputation: 3111
ASP.net works complety different to the way tath does PHP
the code behind code is compiled in a dll and interpreted by ASP VM in your webpage; how this code is compiled in a DLL you can add the bugfixes on-the-fly like PHP , you need to reopen the project and recompile the web project if you won't ,uninstall the web application and reinstall the new.
compile the project with the bugfixes in release mode copy the dll of your main project named [nameof your project].dll and copy into the folder bin inside the folder of your application in the web server ... that should works ... if don't the recompile and uninstall /install your app again ...
sorry but its one of the incoveniences of this plataform
Upvotes: 2
Reputation: 5980
If you deploy web site as .aspx and .cs files, it is compiled automatically whenever you put there a newer file. It is compiled when the first web client requests something. I use this feature often for my noncommercial websites, because it is much faster to upload a single file than to redeploy a whole web site from scratch.
Upvotes: 3