Tag Archive for building

Haciendo publish de un web application con nant

Hace unos días publiqué acerca de haciendo deploy de una solución con un web application project en msbuild. Bien, ahora que necesito pasarla a nant (este proyecto fue el único en que tenía mi building en msbuild) nace la misma pregunta: Y cómo hago para el “publish” de esa web application project?

La respuesta es sencilla, usando msbuild :d, claro, mediante la msbuild task de nantcontrib :D

He aquí el equivalente de la tarea en nant:

<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd" name="WebApp" default="build">
  <property name="project.weboutput" value="publish" />
  <target name="publish">
    <msbuild project="WebApplication1.sln">
        <property name="configuration" value="release" />
        <property name="outdir" value="${project.weboutput}/" />
        <property name="webprojectoutputdir" value="./../${project.weboutput}/" />
    </msbuild>
  </target>
  <target name="clean">
    <delete>
        <fileset>
            <include name="**/bin/**" />
            <include name="**/obj/**"/>
        </fileset>
    </delete>
  </target>
</project>

Claro, vuelvo a recordarles, para que esto funcione simplemente tienen que tener nantcontrib entre su instalación favorita de nant :D

Haciendo publish de un WebApplication en MSBuild

Generating NHibernate Database Schema with a MSBuild Task

Today I need something really particular with NHibernate, I need to generate a “test” database schema from my MSBuild task in a particular Target. I know, there are simple options like use hbm2ddl (part of the NHibernate distribution) and this simple Mike Nichols’ MSBuild task but I want to use the hibernate configuration file.

This is my first attempt to do this in a MSBuild task, write this task in MSBuild was a very trivial code exercise, I need to improve it and get more things done, but right now I think is enough to get the job done.

The usage is very simple:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
    DefaultTargets="Test">
  <PropertyGroup>
     <NHibernateConfig>hibernate.cfg.xml</NHibernateConfig>
  </PropertyGroup>
  <ItemGroup>
    <TestDatabase Include="./test.db" />
  </ItemGroup>
  <UsingTask AssemblyFile="../bin/Rioshu.Msbuild.dll"
        TaskName="NHibernateSchema" />
  <Target Name="Test">
    <Delete Files="@(TestDatabase)"
        Condition="Exists('@(TestDatabase)')" />
    <NHibernateSchema ConfigurationFile="$(NHibernateConfig)"
        Export="true" />
  </Target>
</Project>

You can grab the bytes here: NhibernateSchemaMSBuildTask.zip