Last post Aug 03, 2007 02:42 AM by aboreham
Jul 30, 2007 10:35 AM|cribe|LINK
I'm using Web Application Project for my site. I do have several sub projects which are of type "Web application" too. (the site is quite big so I had to split it). So I do have one "root" project which is configured as a IIS application and several "child"
projects, which aren't configured as IIS-applications and are saved below the root project. (you don't know what I mean?? -->
I now want to deploy the whole project at once. It seems like this is quite tricky and I hope I can describe the problem exactly. The problem is that I don't want to only copy all of the source files because this isn't very secure.
My first try: Using "Publish Project".
The problem here is that I have to "publish" every sub project seperately. As I have a lot of sub projects, this isn't useable for me.
Second try: Using xcopy
In project-settings of my root project I added some post-build-code. this code should copy all needed files (without .cs, ...) to a output folder.
Here's my code (in "exclude_files.txt" I have all patterns of files I don't want to copy):
xcopy "$(ProjectDir)*.*" "c:\publish" /EXCLUDE:..\SOLUTI~1\exclude_files.txt /C /S /Y
this works but the problem is that the "root"-project get's build before all sub projects, so the files get copied immediately after the build of the root project and changes to the dll's of the sub projects get ignored! As the sub projects need to have
a reference to the root project, I can't change the build order...
Third try: Using "Web Deployment Project"
I set up a web deployment project for my "root"-project and configured the msbuild-code to exclude all unneeded files (.scc, ...).
Here I again have the same problem as with xcopy. the build order of my solution now is: 1) root project, 2) deployment project, 3) sub project 1, 4) sub project 2, ...
So again, the deployed output doesn't have the most recent version of the sub project's dll's. (aspx-files are most recent as they get copied by WDP).
Do you have any suggestions, how I can change the build order or how I can publish the whole solution at once?
Thanks in advance,
Jul 31, 2007 05:03 PM|cribe|LINK
I found a solution on my own. Don't know if it's a good one but it seems to work. If anyone is interested, here's my solution:
I edited the "Web Deployment Project"-File and added some code to build all sub projects before the deployment-actions start. This solution is based on this article:
<!-- search for all projects - don't include this wdproj project -->
<ProjectsToBuild Include="..\**\*proj" Exclude="$(MSBuildProjectFile)"/>
<!-- don't copy these files to output folder to keep it clean. -->
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\Properties\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\obj\**\*.*" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.scc" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.user" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.csproj" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*..suo" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.vspscc" />
<ExcludeFromBuild Include="$(SourceWebPhysicalPath)\**\*.Publish.xml" />
<!-- Uncomment this line to see all projects that get compiled
<Message Text="Project files:%0d%0a@(ProjectsToBuild,'%0d%0a')" Importance="high"/>
<MSBuild Projects="@(ProjectsToBuild)" ContinueOnError="false"
That's all. Now everytime you build the deployment project, all projects are built before!
Aug 03, 2007 02:42 AM|aboreham|LINK
Will Sub Projects be better supported in Visual Studio 2008? They seem to be a hack at the moment.