Sunday, September 23, 2007

MSBuild - What a tool

MSbuild is a great tool to do automatied stuff.

Introduction to <a href="http://www.codeproject.com/books/msbuild.asp" target="_blank">MSBuild</a>
I have used it for some time now on my Umbraco projects, and it really saves me alot of time.
In my project I create a MSBuild script that copies my assembly and usercontrols to my local website, every time i buíld my project.
so my debugging steps change from 7 to 5 steps.

1. Build Project
2. Copy assmbly files to bin folder on IIS [now Automated]
3. Copy ascx files to usercontrols folder on IIS [now Automated]
4. Open website in IE
5. Attach my project to w
6. Go to page that has to be debugged.
7. Find and solve problem.
My msBuld script:


<target name="PostBuildEvent">
<createitem include="$(ProjectDir)$(OutputPath)$(AssemblyName).dll">
<output taskparameter="Include" itemname="OutputFiles"></createitem>
<message text="Copying '%(OutputFiles.Filename)%(OutputFiles.Extension)' FooBar bin directory" importance="high">
<copy sourcefiles="@(OutputFiles)" destinationfolder="$(SolutionDir)bin" continueonerror="false" skipunchangedfiles="true">
</target>

Another way to use MSBuild is to have different configuration settings for production and testing environments read about it on <a href="http://weblogs.asp.net/scottgu/archive/2007/09/21/tip-trick-automating-dev-qa-staging-and-production-web-config-settings-with-vs-2005.aspx" target="_blank">Scott Gu's blog</a>

No comments:

Post a Comment