ASP.NET exclude folder from publishing , but keep files on server - asp.net

I have an old ASP.NET website. need to exclude folder from publishing , but keep that folder on server.
Folder: img contains many images marked as "content"
Publish method: FTP
In setting I have "Delete all existing file prior to publish" UNCHECKED, yet files are still being when publish.

For Visual Studio go to the Solution Explorer, right-click on the file you do not want to copy and then click on properties. Set the "Copy to Output Directory" to "Do not copy."

Related

Add back un-loaded folder in ASP.Net project

I am working on a ASP.Net project and I unloaded a folder "Reports" that had subfolders and RDLC files in it. The folder I un-loaded is from this path:
"C:\Users\TestUser\Documents\Project1\changerapp\Content\reports"
The folder Reports has some sub folders and RDLC files. Now I want to load the Reports folder like the same way it was before. But when I select "Add existing item" , it is not letting me add the folder (with all its contents). Rather it is making me select files inside that Reports folder. Any way to achieve this?
Figured out in 2 minutes after posting the question.
So we have to click the "Show all files" icon on top and select the folder we want to add back. Right click the folder and select "Include in the project" and the folder will be included.

I have deleted app_data folder accidentally

I have deleted an app_data folder accidentally from my project in Visual Studio 2015. It was generated automatically and the database files was there in it. Now I want that folder back,so can you help me how to get that back in my project.
I'm leaning on a more positive side, so I assume you've only removed the folder from the vs project solution explorer.
You could add it back by clicking on the show all file button Show all file
and include back the app_data folder.

Web Setup project not including some content files from ASP.NET MVC project

I am making a WEB SETUP for my ASP.NET application. Below is my folder structure for content folder.
I have added a WEB SETUP project and have included the 'Primary output from Web' and 'Content files from Web'.
But when i right click on the 'Content files from Web' and select the 'Output' option I see the following
only my .svg font is added, the rest 4 files (.eot, .ttf, .woff and .otf) are not added. Even when I run the installer and after the setup is complete I still do not see these 4 files in the Content/font-awesome/font folder.
What should I do to add these to the installer as well ?
Some font related files under your Content folder are probably not specified as "Content" files. You have to make Visual Studio understand that they are Content files. Content files are eventually copied to the compiled output directory when you execute your setup.exe file.
Just select your intended file(s) (using Ctrl-click if there are multiple files), right click choose Properties and from the Properties window, in front of "Build Action" choose "Content" option.
Now when you will Build and run your Setup.exe file, these files would be copied to the output directory.

Where "include files from the App_data folder" option?

According this answer, it should be option "include files from the App_data folder" when you publish ASP.NET application. But I don't see it:
Where it is?
I don't believe that option is in the newest of Visual Studio.
Instead, you should be able to change the Build Action to "Content" by right-clicking on the files in Solution Explorer and clicking "Properties."
This should then include them in the publishing process.
I used a After Build Target. To just create a empty folder on deploy.
Add this to the end of The project file .csproj
<Target Name="CreateDirectories" AfterTargets="GatherAllFilesToPublish">
<MakeDir Directories="$(OutputPath)App_Data\"/>
</Target>
Manually Create the App_Data folder under the published application's root folder
Right click at the App_Data folder and select Publish App_Data folder.
Add an item into the App_Data folder and set the item to be include in the publish.
https://forums.asp.net/t/2126248.aspx?App_Data+folder+missing+in+release

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.

Resources