How msiinv saved my day

In my previous post I reported my problems installing MVC3 in my machine. That led me to further investigation as that worked perfectly in my co-workers’ machines.

I tried to repair Visual Studio 2010 and told me that it had troubles with vs_setup.msi… strange. Looking around I found a post that led me to an explanation of the msiinv.exe tool.

It took me a while to get the tool as the author’s site is broken, but Stackoverflow came on rescue.

Then, I ran the tool:

msiinv -p > msiinv.txt

Then opened the file and… surprise!

Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (1) The product is advertised, but not installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    AssignmentType:    1
    Language:    3082
        Package:    vs_setup.msi
    0 patch packages.

Strange. I tried to fix it with MSI:

msiexec /f {725041D1-9F45-30D3-A78E-DF08C4E1A297}

It asked me for the vs_setup.msi, it’s in the root of the Visual Studio 2010 DVD in case it’s not found automatically. Magically it worked and now it’s installed:

Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (5) Installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    Version:    10.0.30319
    AssignmentType:    1
    Publisher:    Microsoft Corporation
    Language:    3082
       Installed from: D:\VS2010\
    Package:    vs_setup.msi
    Help link:    http://go.microsoft.com/fwlink/?LinkId=133405
    Local package:    C:\Windows\Installer\3f3bc84.msi
    Install date:    2011\01\14
    0 patch packages.

Great! Now the ASP.NET MVC3 RTM setup package worked like a charm.

Install ASP.NET MVC 3 Manually

Update 14-jan-2011: I found the root solution to all my problems with msiinv, check my post on the subject.

I don’t know exactly why but I can’t install the MVC 3 package provided by Web Platform Installer nor the standalone one, so I uncompressed it and tried to figure out how to install it manually.

The problem I have is with vs10-kb2465236-x86.exe that gives me a “failed with 0x8007066a” error. It seems to be for enabling Razor syntax but the prerequisites are Visual Studio 2010 Ultimate ENU. I have Visual Studio 2010 Professional ESN and that may be the reason or may not.

Anyway, I found the way to install the package manually, although the Razor Intellisense stuff is not available in my setup.

First you have to uncompress the AspNetMVC3Setup.exe into a folder and then install the following files (I got the sequence from the parameterinfo.xml file, which describes the installation process):

  • VS10-KB2465236-x86.exe (it fails in my case, I don’t install it)
  • AspNetWebPages.msi – ASP.NET Web Pages
  • AspNetWebPagesVS2010Tools.msi – ASP.NET Web Pages Visual Studio 2010 Tools
  • AspNetMVC3.msi – ASP.NET MVC 3 Runtime
  • AspNetMVC3VS2010Tools.msi – ASP.NET MVC 3 Visual Studio 2010 Tools
  • NuGet.msi – NuGet

And that’s all. In case you have Web Developer Express instead of full Visual Studio, you have ton install the tools specifically for that edition, AspNetWebPagesVWD2010Tools.msi instead of AspNetWebPagesVS2010Tools.msi and AspNetMVC3VWD2010Tools.msi instead of AspNetMVC3VS2010Tools.msi.

Good luck!

Deployment web site Zip with MsBuild and TeamCity

One of the most useful practices that I’ve been using during the last years is continuous integration and for that purpose, TeamCity is the tool of choice, which offers a free professional version with up to 20 users and 20 build configurations, enough for a small team.

Recently I tried (again, first time I found some trouble) to create an MsBuild script to make a web publication to a folder an then zip that folder in order to make a simple distributable with all the things needed to set up our web project that anyone in the organization could download and install, instead of having to create that zip myself or publishing through Visual Studio.

Finally, I got the script and seems to work using MsBuildCommunityTasks and some community knowledge.

The first part deals with publishing the site:

  <PropertyGroup>
    <OutputFolder>$(MSBuildProjectDirectory)\publish</OutputFolder>
    <TempFolder>$(MSBuildProjectDirectory)\temp\</TempFolder>
  </PropertyGroup>
  <Target Name="PublishSite">
    <Message Text="Publishing in folder: $(OutputFolder)" />
    <RemoveDir Directories="$(OutputFolder);$(TempFolder)" ContinueOnError="true" />
    <MSBuild
      Projects="src\Adapting.Web\Adapting.Web.csproj"
      Targets="ResolveReferences;_WPPCopyWebApplication"
      Properties="Configuration=Release;WebProjectOutputDir=$(OutputFolder);OutDir=$(TempFolder)"
      StopOnFirstFailure="true" />
    <RemoveDir Directories="$(TempFolder)" ContinueOnError="true" />
  </Target>

I define some variables and then I call the _WPPCopyWebApplication which is the important target (in .NET 2.0 was _CopyWebApplication). This should be the same as publishing a web site to a folder using the wizard.

Then, I get the files in the OutputFolder and make a zip with them:

  <Target Name="PackageSite" DependsOnTargets="PublishSite">
    <ItemGroup>
      <PublishFiles Include="$(OutputFolder)\**" />
    </ItemGroup>
    <Message Text="Packaging Site" />
    <Zip
      Files="@(PublishFiles)"
      ZipFileName="release-web.zip"
      WorkingDirectory="$(OutputFolder)"
      />
  </Target>

I simplified this a little bit because I have as well a target that generates the build number from SVN and changes the AssemblyInfo.cs and uses this numbers to name the zip.

In TeamCity, you can create a new configuration with *.zip as artifacts, that points to your SCM (Subversion in my case) and the most important thing is that uses the MsBuild runner targeting PackageSite.

The only thing that was that if I put the <ItemGroup> section out of the <Target>, works on the command line but not inside TeamCity.

That’s all, I hope this helps.

Sources: