Visual Studio .NET Tips: Easy Deployment with Copy Project & Database Projects
Easy Deployment with Copy Project
While Copy Project will prepare your web application for XCopy deployment, the tool often has trouble doing the copy over a network. The key to using Copy Project effectively is to copy the files to your local machine and then you can copy them to the final destination on your network.
Begin by creating a folder named deployment under the file structure of your web application.
Return to VS.NET and click on the Copy Project icon in Solution Explorer
Fill out the Copy Project dialog.
The Destination Project Folder you enter your website url (usually localhost) and the new folder you just created, depolyment.
The Web access method will give you two choices of how to copy the files to the destination. Do not choose FrontPage. The FrontPage method will more often that not cause you problems. Choose file share as your file copy method.
The Copy selection will allow you to choose what files are copied. You want to select the radio button for Only files needed to run this application. This will exclude source files, resx, and any other non-front end file necessary.
After you have filled in the proper values click OK.
If you have done the copy project before, you are prompted with a confirmation dialog box like the one below.
Apply your changes to all items and click OK.
The copy will now begin and a full copy (front-end files only) of your application will now be in the deployment folder. You may now copy these files to any location on your network or FTP the files up to your web server safely.
Maintaining the changes done to a database can be a hassle. You can spend the money on ERwin or you can implement this no-cost, yet reliable method for tracking database schema changes.
The key to this technique is to turn on Save Change Script in Enterprise Manager to create a script of any changes you make to your database.
Creating the Project
Open an existing project in Visual Studio .NET 2003 (VS.NET) and right click on the project and select Add New Project.
Select Other Projects -> Database Pojects -> Database Project from the list and name your new project.
Now you will associate a data link connection to the project. You will see one of two different dialog boxes depending on if you have any existing data links setup through VS.NET.
If you have existing links you will see:
If you see this dialog box, choose the database you would like to maintain the schema changes for and click OK.
If you do not have a data link connection already setup you will see:
Fill out the required information to establish the link:
Now you can add SQL files to the project that will track the last changes done to each table.
Now you will want to maintain when and where the changes are applied. To do this you need a simple Excel spreadsheet. Open Excel and setup a new sheet to match the structure below.
Notice the three date columns. You make an entry for the date the changes went into development, staging, and production. Before each build all you have to do is check this document to see what is not the system you are targeting and update the date field once the changes are made.
Save the document under the file structure of the database project.
Now add the worksheet to the project by right-clicking on the database project and selecting Add Existing File.
Locate the spreadsheet and add it to the project.
Now when you want to update the worksheet you can double click on the file name and Excel will open with your file.
Add this project into Source Safe and you will have a complete revision history to all the changes done to the schema of your database.