1. Overview
Some deployment settings can be set in the project properties and remain in the project file (. csproj or . vbproj). In most cases, you can select Project properties in Visual Studio and set these parameters in the Properties window. This section will show you how to set these parameters.
2. Configure deployment parameters in the Project Properties window
Setting parameters that affect project deployment can be set in the package/publish tab of the Project Properties window. You can set different parameter values for different build configurations, and this section will guide you through the default settings and then change the content.
solution Explorer , right- contosouniversity The project, select the Properties property, and then select package/publish Web tab.
When the window is displayed, the default build configuration is the currently used configuration, and if it is not Active (test), manually select test To ensure that the parameters we modified later are deployed to the test environment.
When you switch to the Active (test) or test option, the default values are displayed, and when the test build is configured, you can modify the following:
- Only files needed to run the application would be deployed (deployed only. The other 2 options are all files in this project or all files in the This project folder. The default option is to let you avoid deploying source code to the site, which is why the SQL Server Compact Assembly Class library is not deployed. For more information, see the ASP. Application Project Deployment FAQ Why don ' t all of the files in my project folder get D Eployed? Chapter.
- Choose Exclude generated debug symbols because you do not need the debug operation in the test environment.
- There is no need to select the Exclude files from the App_Data folder because it includes the SQL Server compact database files that need to be deployed. The next time you upgrade your deployment, you should choose this option.
- There is nothing to configure the database on the package/publish SQL tab. So the Include all databases configured in Package/publish SQL tab option has no effect. You will need to use the package/publish SQL tab when deploying the full version of the SQL Server database. The SQL Server Compact is deployed as data, so it is not required.
- Because this tutorial requires One-click publishing, the settings for the Web Deployment package Settings block are not working.
The package/publish Web tab for the test build configuration might look like this:
Change the value of the configuration drop-down menu to release, and the default value is the same as the release build configuration. Also select the Exclude generated debug symbols setting for release.
3. Ensure that the Elmah directory is deployed
In the previous section, we configured the Elmah NuGet package to provide logging and reporting capabilities, and in the Contoso University program, Elmah logged the logs to the project's Elmah folder.
It is common to exclude files or folders from deployment, and another example is the folder for uploading. You certainly do not want the test environment generated logs or uploaded files are not familiar to the production environment, in addition, in the deployment of upgrades, it is certainly not possible to produce production environment logs or uploaded files are deleted. (If the target environment exists but the development environment is present, you need to delete it when you deploy it, depending on how you set it up).
If you set the Items to deploy option for the package/publish Web tab as only Files Needed to run of this application , that Elmah log files generated in the development environment will not be deployed. (If you need to deploy, the project Build Action property that you need to set these files is Content .) More information can be accessed asp.net WEB Application project Deployment FAQ , " why don ' t all of the files in my Project folder get deployed? "chapter). However, the Web deployment will not deploy this folder unless there is at least one file in the Elmah file. Therefore, you need to add a simple . txt file in order for the folder to be deployed.
Solution Explorer, Mail Elmah folder, add New item to theoption, and then create a file with the name Placeholder.txt , which reads: "This isa Placeholder file to ensure the folder gets deployed. ", and then save. This is what you need to do, because the default Build Action property of the. txt file is already a Content .
Now that you have completed the deployment configuration, you will deploy the Contoso University program to the test environment and test it in the next section.
Copyright NOTICE: This article for Bo Master http://www.zuiniusn.com original article, without Bo Master permission not reproduced.
Microsoft ASP. NET Site Deployment Guide (4): Configuration Item Properties