title: Package Web app with MSBuild on Windows Server 2012 RC
body: <p>I'm using a Windows Server 2012 RC with IIS 8 (on Windows Azure, the new VMs).</p>
  
  <p>I've got TeamCity installed as my build server. I migrated from a current installation where everything worked fine.</p>
  
  <p>The only thing that doesn't work is running MSBuild with the Package target against an ASP.NET MVC 3 application.</p>
  
  <p>The last section of the MSBuild log, just before it has to actually create the package looks like this:</p>
  
  <pre><code>[MyProject\MyProject.MvcClient\MyProject.MvcClient\MyProject.MvcClient.csproj] PipelinePreDeployCopyAllFilesToOneFolder
  [21:46:16][PipelinePreDeployCopyAllFilesToOneFolder] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] Publish Pipeline Deploy phase Pre-Deploy CopyAllFilesToOneFolder Stage
  [21:46:16][MyProject\MyProject.MvcClient\MyProject.MvcClient\MyProject.MvcClient.csproj] Package
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] Invoking Web Deploy to generate the package with the following settings:
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(LocalIisVersion) is 7
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(DestinationIisVersion) is 7
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(UseIis) is True
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IisUrl) is http://myproject.web
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IncludeIisSettings) is true
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(_DeploymentUseIis) is True
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(DestinationUseIis) is True
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IisUrl_SiteID) is 2
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IisUrl_SiteFriendlyName) is myproject.web
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IisUrl_SiteRelativePath) is /
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(IisServer_IisAppPoolName) is myproject.web
  [21:46:16][Package] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] $(_Destination_IisServer_IisAppPoolName) is myproject.web
  [21:46:16][Package] MakeDir
  [21:46:16][MakeDir] Creating directory "F:\Workspace\DeployPackages\2012-07-11_09-45-53\".
  [21:46:16][Package] CallTarget
  [21:46:16][CallTarget] GenerateMsdeployManifestFiles
  [21:46:16][GenerateMsdeployManifestFiles] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] Generate source manifest file for Web Deploy package/publish ...
  [21:46:16][GenerateMsdeployManifestFiles] CallTarget
  [21:46:16][CallTarget] CollectDatabasesToPublish
  [21:46:16][CollectDatabasesToPublish] MakeDir
  [21:46:16][MakeDir] Creating directory "obj\Release\Database".
  [21:46:16][CallTarget] PackageUsingManifest
  [21:46:16][PackageUsingManifest] GetPublishingLocalizedString
  [21:46:16][GetPublishingLocalizedString] Packaging into F:\Workspace\DeployPackages\2012-07-11_09-45-53\MyProject.msbuild.zip.
  [21:46:16][PackageUsingManifest] VSMSDeploy
  [21:46:16][VSMSDeploy] Starting Web deployment task from source:manifest(F:\Workspace\DeployPackages\2012-07-11_09-45-53\MyProject.msbuild.SourceManifest.xml) to Destination:package(F:\Workspace\DeployPackages\2012-07-11_09-45-53\MyProject.msbuild.zip).
  [21:46:16][VSMSDeploy] C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009, 5): Web deployment task failed. (There was an error reading IIS configuration schema from 'C:\Windows\system32\inetsrv\config\schema\'.)
  [21:46:16][VSMSDeploy] Package failed.
  [21:46:16][MyProject\MyProject.MvcClient\MyProject.MvcClient\MyProject.MvcClient.csproj] Project MyProject\MyProject.MvcClient\MyProject.MvcClient\MyProject.MvcClient.csproj failed.
  [21:46:16][MyProject\MyProject.msbuild.teamcity] Project MyProject\MyProject.msbuild.teamcity failed.
  [21:46:16]Process exited with code 1
  </code></pre>
  
  <p>And the actual error message being this:</p>
  
  <pre><code>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009, 5): Web deployment task failed. (There was an error reading IIS configuration schema from 'C:\Windows\system32\inetsrv\config\schema\'.)
  </code></pre>
  
  <p>First, I tried running the build agent as Administrator, since I thought this might be security related. That didn't help.</p>
  
  <p>Then I tried to install Web Deploy 3.0 on the server. No luck either.</p>
  
  <p>Last thing I can do, but really don't want to do -- is to remove the IIS settings from the project file.</p>
  
  <p>Any ideas?</p>