Where "include files from the App_data folder" option? - asp.net

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

Related

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

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."

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.

mvc which files are needed for deployment?

I've been working with webforms and recently started to work with mvc. With webforms, when we use to push to the qa/prod server, we alway copied over the files. leaving behind the .cs files, so just the .aspx, bin folder, along with associated js/css files would go.
with mvc, if we are copying the directory over from our pc (where we develop), what files are needed, do we need the .cshtml files for example? I just want to avoid having to push all the files if they are not needed.
They are definitely not all required. What you are going to want to do is setup a way to publish, this ranges from doing a "bin deploy" to feeding in ftp settings and using a "single click deploy" approach.
What it all boils down to though is this. You will need
A bin folder with every relevant .dll
A content folder with relevant images and css files
A script folder with relevant .js scripts
A views folder with nested folders for views with relevant .cshtml files
A .webconfig file in the views folder and also one at the very root
The packages.xml file at the very root
The global.asax file with markup pointing to the application starting in global.asax.cs
What this excludes is every single .cs file. These will all be composed into your projects .dll. So if you are developing FunWebApp, then all your c# will be rolled into FunWebApp.dll in your bin folder.
Use the Visual studio "Publish" option available on your UI Project. This will generates all the required files you neeeds includes, bin folder, Views folder(which will have the .cshtml files),Content folder,Script folder, Config file(web.config) etc.
Right click on your project and select "Publish". You will be shown a wizard where you can define what kind of publish you want. You have different options like FTP, File system etc.
You will not see the Controllers folder / Other class files because code inside that folder is compiled to your assembly which is in the Bin folder

typescript for web forms

Is typescript supported on web forms?
I have an existing asp.net 4.5 web forms project where typescript does not seem to be working.
I cannot create a new file, but even if I rename an existing to .ts it does not seem to be working. No build, no intellisense, nothing!
Found the answers to my problems:
I was trying to find "Typescript file" in Web folder of the "Add New Item" dialog, although it is in the "Visual C#" folder ..... Why?
Unless you have a .ts file created with "Add New Item" in your project, the option "TypeScriptCompile" on the "Build Action" of the file properties is not available and it raises an exception. After the first file is created, then you find this option and can manually set it to a .ts file.
The option "Typescript file" is not available in the "Add File" options unless you have a .ts file created with "Add New Item" in your project and you are in a "Scripts" folder (if you name differently the folder where you want to add this file, this option wont be available). Of course you can add a .ts file from "Add New Item".
You cannot easily create a ts file by your own, you must use "New Typescript file" from menu. That is because: A) The code page of the file must not be Unicode (I was trying to figure out that problem for many hours). if you try to compile a unicode .ts file with tsc, nothing happens!! After I saved the .ts file as Greek(Windows) - in my case-, everything worked fine! B) The .csproj properties that must be set for each file to work correctly are quite complex. (I was trying to create a .ts file starting from a .js file and renaming afterwards.... and then playing with .csproj)
I just created a new Web Application using web forms (empty project).
I found I have to add the Target to my project file...
<Target Name="BeforeBuild">
<Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" #(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
You need to right-click and select "Unload project", then right-click and select "Edit". This block can go right at the end, just before the </Project> tag.
I didn't have any problems adding a TypeScript file in Visual Studio 2012.

Resources