Elimination of Aspx pages during Publish - asp.net

I need to eliminate .apsx pages for my application for different locations basically.
How can I eliminate those pages during Publish time?
I have seen by making pages to Build Content to none. Is there any other alternate
solution?
Regards,
Sachin K

I would suggest using Web deployment project and follow these steps:
Add your WDP (web deployment project).
Right click on it and click on Open Project File.
in the wdproj file you will see a tag called <ItemGroup>.
Inside this tag add the following line:
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\FolderName\**\*.*" />
Save and close your wdproj file and that’s it.

Related

Publish only edited page in asp.net

Whenever I update a small part of my website I have to upload whole website again.
If i upload only edited part it throw me exception.
The way I upload my website:
For example if I have 4 pages (home, register, about me, contact me) and if I update home.aspx, I publish whole website in a local address, and then I compress it with zip format and upload it manually.
Is it possible to publish only updated part?
It is not possible to publish only a part of website, but what you can do is to choose Single-File Assembly build option ,by this you can get single assembly for your page.so intead of updating whole application you can update only the pages you change
read more
What I always do when publish ASP.Net Webform project, I complate it with two steps. Maybe this way suitable for you.
When you use publishing tool on visual studio by selecting Build menu -> Publish, you can choose "File System" as "Publish Method", type your "Target Location", and select "Replace matching files with local copies". It mean the project will publish modified files only.
After publishing have done, Open defined "Target Location" using windows explore and sort by "Modified Date" and just copy newer modified files for each directory recursively to your server.
If you build the website pages into dll. You can not published only the aspx. there are many other dll and compiled files in bin folder, we don't know which matches which aspx.
If you only edited the "view", i mean, the html and markup part of <%%> code, and no code behind (.aspx.cs) change, you can published only this aspx. But remember to set website as updatable in the publish dialog.
I suggest you to compile the aspx into one dll. according to #Buzz 's answer. Then, your aspx files would be only an empty file. All you need to do is upload only one dll to the bin folder.

Deploying a Pre Compiled Web Site Project

So I have a website project, which I precompile when I publish.
I have a question, when I need to make a small change to the deployed site, do I have to rebuild, re-publish and deploy the entire website structure again, or can I just copy the modified aspx page and the bin directory?
Please let me know!
Thanks guys!
It is going to depend on how you did the precompiling of the site.
According to MSDN, if you did a precompile for deployment, the process takes aspx files and processes any internal code in them, so you will need to recompile everything.
If you did a precompile for deployment and update, the aspx files are not taken into consideration, so provided all you did was some UI changes, you can push the updated aspx file up without issue.
You should be able to republish locally and then copy up the modified published pages and the bin folder.
You shouldn't need to upload everything.
If you pre-compile epending on the options you have chosen you may be able to edit the .aspx page i.e. HTML code, but not the code-behind..
If the .aspx pages become just placeholders i.e. they are empty inside except for a single comment, you cant.

Can you precompile and merge part of an ASP.NET website and then continue development?

A big part of the web site is precompiled and merged, since it's almost never going to change. The precompiled bits can be replaced in case of updates to the original. I want to continue development of new pages, but when I browse to a new page I get the following error:
The file '/Website/Test/Default.aspx'
has not been pre-compiled, and cannot
be requested.
Is there any way around this?
Edit:
If I remove the precompileApp.config file I get the contents of the marker files when I browse them:
This is a marker file generated by the precompilation tool, and should not be deleted!
Have you looked at the precompile with updatable UI option? This compiles all the source code and resources into a DLL but allows you to continue making changes to your .aspx pages after deployment.
Another option could be to precompile the website in place on the server instead of precompiling it then deploying it to the webserver.
Both options are addressed in this MSDN article:
http://msdn.microsoft.com/en-us/library/bb398860.aspx

ASP.NET Setup Project - how to include static files not in VS?

I am working on an ASP.NET MVC web application, and am working on the Web Setup portion. We are using SVN for version control. One of the issues is that the we are currently having is that the web designers modify and add a lot of html, css and js files that end up in the Content folders, but they don't add them to the VS project, so the new files don't get included in the installer.
One option is that we have to try to teach them to always go into VS and manually add the files, but we're on a large project and it's getting down to crunch time, so trying to get people to learn something new in a technology that they don't know will result in too many mistakes, so I'd like to work around that if possible.
Is there some way to get the setup project just to include files from a folder on the file system, instead of a project's designated content files?
Thanks!
I think I've figured it out:
Make sure that the installer project includes the Content Files for the web app. Then go into the web app's csproj file with a text editor and find the ItemGroup where the static Content files are listed. Then add an entry with a wildcard in it and the installer will package them in.
<ItemGroup>
<Content Include="Content\test.html" />
<Content Include="Content\*.html" />
<Content Include="Content\*.gif" />
<Content Include="Content\*.css" />
<Content Include="Content\*.jpg" />
<Content Include="Content\*\*.js" />
Right click on the folder in the File System view of the Web Setup project, and select Add, File...
It doesn't look like you can add an entire folder this way though, so you would have to add every file individually to the Setup program.
EDIT:
Aren't all files from your project folder included in a WebSite project in Visual Studio? Then it's just a case of having your WebSite project and Web Setup project in the same solution, then right-click on the Web Application Folder in the Web Setup project, select Add, Project Output... and then select the WebSite Project in the drop down and Content Files from the list box and click OK.
Unfortunately I don't think there is an out of the box way to do this, as projects maintains references to the files individually.
You could achieve what you need via a custom macro, or asking your other team to edit the .csproj XML file (perhaps simpler or riskier, depending on their background).

How do you update an ASP.NET web application?

Simple question. If you have a compiled and published ASP.NET web application running on a server and you need to update, say, a line in one of the codebehind files. Do you shut down the entire site, republish, then load the site back up? Or do you publish straight to your live site with users still using it?
For myself, place an app.offline app_offline.htm file into the site, then overwrite the entire website with the latest published build.
there are a few options when building a site -> one dll for the site or one per page. if u just updated one line in a code behind, and you have chosen the build option for one per page, then you can just copy/paste that new page dll.
i don't like that method personally. I find it simple to app_offline.htm the site.
If it is a single file and a simple site that uses that app_code folder to store the code behinds, I simply xcopy up the new files. If I use http expiration headers I may need to do some better scheduling to make sure things like javascript files and css sheets match the rest of the site that was updated.
For emergency patches:
If its just a codebehind file, I copy the entire /bin/ out and replace all DLL's (mostly out of habit)
If its an aspx, I just copy the aspx.
For actual deployments, I have an automated system that checks out the code from source control, builds a clean release build, takes the site offline, and then robocopies it out to the deployment target. Its a one click process (Thanks CruiseControl!).

Resources