c# copy directory during publish - c#

I want to copy a folder that's contained in another project into the publish directory during website publish, is this possible?
The reason for this is that I have a project with the SQL schema files for creating the database structure, ASP.NET membership schema, alongside some code to run the files against the database. I don't really like having these SQL files in my web project, that just seemed dirty. So I figured I'd store them somewhere else in the solution. But when I deploy I do need them in the publish directory.

Why not place these scripts in App_data? It will be deployed along with the rest of the website, and cannot be accessed via client web browsers. That's what it is there for, to store data associated with your website that you don't want to have in the root for security purposes.

You can include an extra folder for deployment with all its contents editing the publish profile: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files

Related

How do I modify and deploy Edit.aspx in Kentico 7?

We are on kentico 7 and for some reason, none of my edits to Edit.aspx are showing up locally or on our dev server. Usually, I just modify a .aspx or .cs file on my local machine and they appear on my local server when I launch the site. Is there a special way to modify/deploy this file? The file full path is: site\CMSModules\Content\CMSDesk\Edit\Edit.aspx.
Best practice is to NOT modify any of the Kentico base files. BUT I'm assuming here since you're on v7.x that you're most likely not upgrading to a new version any time soon so this will come down to how your site is set up. Is it a website or a web project? Website will have an /App_Code directory.
If you have an /App_Code directory, then you'll make the changes to your ascx and .cs files and copy them to your production server. If you have a web project, then you'll need to build the project and redeploy the site, including the new dll, to your production server.
Don't ask how to copy the code to your servers because that will be something you need to figure out on your own on how to access your production servers. Don't reply with any of your dev or prod server info, it's not a good idea at all.

How to deploy ASP.NET MVC app via sftp

My university allows me to deploy my web app only via sftp. Visual Studio deployment tool does not support sftp. What's the best way to solve that problem?
You don't need the VS publish tool.
For a ASP.NET MVC site, you need to upload contents of the project folder, except for anything that will have been compiled... Open Visual Studio, compile your project, then upload via FTP.
Upload the bin folder with the compiled dll's, along with any views, scripts (anything that will be served to the client), and config files in the folder structure inside the project directory.
Basically, upload anything that doesn't have a .cs file extension. The exact files will vary based on your project. (You don't need .pdb files, or your .csproj file either)
If a folder contains only .cs files, you don't need it since it'll be compiled in the dll's (like the Controllers folder). If a folder contains anything else (.cshtml, .js, .css, etc) then upload it.
This can all be done via an FTP client like CuteFTP, FileZilla, Cyberduck etc. Just connect to your server and upload to the directory that is set up for your application in IIS.

Promote select files to IIS7 site

Say I have a c# web application project in a TFS Team Solution that I am deploying to a development server (IIS7). I want to be able to promote only certain code changes to a test server, and then later promote ONLY those changes to the production server.
So for example changes to a web user control and a javascript file should be promoted, but a change to a web form should not be promoted.
Using the deployment feature in Visual Studio seems to be an all-or-nothing proposition.
Short of manually selecting files to copy/paste, or write some kind of app that compares files in a target and source directory, list files that are different, and lets you select source files to promote, what do teams usually do in this situation?
In short: how can I reliably promote select files/code from environment to environment without also including other changes that should not be promoted?
Create two branches in TFS, one for development and one for production.
Merge dev->production only changes that you need.
Create deployment packages from production branch.

Transfering ASP.Net Website Project From One Computer To Another

Ive been working on a project on my computer and i want to transfer it to my laptop. The project is an ASP.Net Website Project in C#. I'm using SQL Server 2012 to hold my database and the Asp.net user management tables in my database also.
What's the easiest way to do this, as i have backed up my database and copied the ASP.net website folder onto my laptop and changed data source, but I'm getting a few errors, especially on the asp.net configuration page it has also removed my roles due to the transferring.
If i understood you correct, what you need is to deploy the ASP.NET Membership Database to the new project location. There are set of tools and commands that you need to use.
You would need to construct a command-line like the following:
C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync
-source:dbfullsql=" [your connection string] "
-dest:dbfullsql="c:\temp\InsertIntoAspNetDB.sql
Again the exact path and command will depend on your local configuration.
You may get more detailed information from MSDN - How to: Deploy a Database With a Web Application Project

How do I unpublish a .Net application

I published a C# .net application to the wrong folder. I am using VS 2005. How do I unpublish the app to be able to republish in the correct folder.
I tried simply publishing to another folder and now the app will not run from either location.
You will need to manually delete all the published files from the wrong folder.
There is no "recall"/"unpublish" function in VS. All "publish" does is compile and copy compiled files and other included files and folders (images, css, js etc) to the specified directory.
Publishing is essentially just a copy of the built application to the destination folder, as far as I aware. This points to a different problem in your application as being the source of your error.
More than likely your app isn't working from either folder because it's configured to use asp.net 1.1 or doesn't have asp.net installed at all on the server. If it is installed, and both 1.1 and 2.0+ are installed, it will default to 1.1, and the folder needs to be configured to use 2.0+.
But other than that, you just delete the files from the server by hand.
Publishing function also creates "Application" on the IIS, so I would probably start by opening the IIS server with "Internet information services manager", and remove the application with the wrong folder.

Categories

Resources