I am using visual studio 2010. I have a website project that I would like to build a website deployment package every time I build a the project. Basically I am looking for some example of a post build MSBuild command that will basically do the same thing as the "Build Deployment Package" option from the right click menu of the website.
+1
A:
Hi, I assume you are using Web Application Projects, because Web Site projects do not have the "Build Deployment Package".
I would recommend not performing a package on every build, because it will slow down your development drastically. With that being said, you can do it here is how.
If you really wanted to do this your best bet is not to use post-build event, but to edit the project file and extend the build process. To do this open the .csproj file for your web and then towards the bottom (after the Import elements) place the following
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
Package
</BuildDependsOn>
</PropertyGroup>
What this does is extend the build process to call the Package target. This is the same target that is called when you invoke the "Build Deployment Package" target in Visual Studio.
Sayed Ibrahim Hashimi
2010-07-01 14:56:51
This doesn't work. There is a circular dependency involving target "Build". (Package call Build, Build call Package...)
madgnome
2010-07-01 14:58:59
@madgnome do you have error message? I just tried this.
Sayed Ibrahim Hashimi
2010-07-01 15:48:07
error MSB4006: There is a circular dependency in the target dependency graph involving target "Build".
madgnome
2010-07-01 15:50:40
I've tried on another computer, and it works. So nevermind ^^
madgnome
2010-07-01 17:14:08
That worked for me. Thanks
Vadim Rybak
2010-07-01 18:37:08