We tried to follow most of what’s written in this link:
However “Copying Files to the Web Application Project” step requires you to copy files from Website to Web application project which would add files. This results in loosing of TFS history which didn’t meet our criteria.
These are the steps we followed to convert as far as I recollect:
- Create an empty web application project with name “UIWebApp” (Obviously any name you want).
- Close solution in visual studio but keep visual studio open.
- Open Source control explorer or visual studio command prompt. Our website was in folder UI. We moved all the files from folder “UI” to folder “UIWebApp” using the following command
- tf.exe rename "$/PROJECT/UI/*.*" "$/PROJECT/UIWebApp/". Rename operation guarantees TFS history will be preserved. To Do this from Source control explorer you will have to individually right click on each file and move it to its new location. We had over 10,000 files I guess, so it was difficult for us to do this from Source control explorer. Check In.
- After this step we opened the solution went in “UIWebApp” project, selected show all files and included all the files we moved in the previous step and used the “Include in project” option.
- Select all files in APP_CODE in the web app project and in properties make sure the build action is set to compile. (We moved all the files from APP_CODE in a seprate library and added a reference to that library in the web app project. This link tells more about this step http://vishaljoshi.blogspot.com/2009/07/appcode-folder-doesnt-work-with-web.html)
- We removed the website “UI” from the solution and also cleared all the related files and folders from TFS. This will help if you want to rename your app to same name as your website which in our case we did rename it to “UI”. Check In.
- Make sure that the references for the user controls are correct.
- Now right click on the Web Application project in solution explorer and click convert to Web Application. This step could take several hours if your website was huge. Took us hours. It adds designer files for each aspx and ascx page and fixes all the changes keyword Codefile to Codebehind. Check In.
- If your deploy included web config transformation that should now be done in Web.config.Release. Follow the examples in the Web.config.Release.
- Build. This should be it for conversion.
Other than maintaining history we faced problems with our automated deploying since we decided to separate some folders into separate Web Applications for ease of maintenance and maintaining these Web Apps as virtual folders. You can read my blog for separating web applications at http://abhighag.blogspot.com/2012/03/separate-web-application-into-multiple.html
If your conversion doesn’t involve creating separate web apps then you won’t need any change in builds. Also before we used to use Web application deploy projects for deploying with websites but we switched to msbuild since that makes sure that the web config tranforms are handled correctly.
If your conversion doesn’t involve creating separate web apps then you won’t need any change in builds. Also before we used to use Web application deploy projects for deploying with websites but we switched to msbuild since that makes sure that the web config tranforms are handled correctly.
This is the command line we used for auto deployment:
msbuild .\WebApp\Www\XY\XY.csproj "/p:Platform=AnyCPU;Configuration=Release;WebProjectOutputDir=..\..\..\Source\en\XY" /t:_WPPCopyWebApplication
If you get "Projects have recently been added to this solution" or "Some of the properties associated with the solution could not be read" when you open the solution then follow this link
If you get "Projects have recently been added to this solution" or "Some of the properties associated with the solution could not be read" when you open the solution then follow this link
No comments:
Post a Comment