Quantcast
Channel: Web Deployment Tool (MS Deploy)
Viewing all articles
Browse latest Browse all 663

ERROR_EXCEPTION_WHILE_CREATING_OBJECT and MapUriToIisWebServer task

$
0
0

I am trying to build web deployment packages which include a parameter for "IIS Web Application Pool Name" in the Project.SetParameters.xml file. I would like to do this using MSBuild; I use Jenkins for CI/CD with MSDeploy/Powershell for deployment, and will not be building, packaging or publishing through Visual Studio.

I would also like to leverage IIS Express for this, and not require 'regular IIS' to be installed on my build machine. So, I have selected the 'Use IIS Express' option in my projects.

Has anyone done this successfully? Is there a trick to making it work?

The problem I am running into is that as soon as I add "/p:IncludeIisSettings=True /p:IncludeAppPool=True" to my msbuild command, I get failures like the following on my build machines:

"B:\workspace\job\Project\Project.vbproj" (Rebuild target) (3) ->
(PackageUsingManifest target) ->
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(3914,5): msdeploy error ERROR_EXCEPTION_WHILE_CREATING_OBJECT: Web deployment task failed. (Object of type 'manifest' and path 'manifest xml hidden' cannot be created.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.) [B:\workspace\job\Project\Project.vbproj]

I have followed the link and read the page. It doesn't say anything helpful regarding this particular error. I have observed this on every build machine I've tried, on Windows 2012, R2, and 2016, with either Visual Studio 2013 or 2015 installed, regardless of patch level (including 'the latest'). It occurs via Jenkins, and if I log in as myself to execute the same commands.

The strange thing is that my project builds correctly on my development system, i.e. I can run the exact same build commands against the same code and everything works. So, this seems to be an environmental issue, but I am having a very hard time narrowing down what it could be.

One thing I have noticed is that the build output is slightly different with respect to the package target when building on my dev workstation vs. the build machine, and on the build machine when I pass "/p:IncludeIisSettings=true" vs. not.

Dev workstation:

Package:
  Invoking Web Deploy to generate the package with the following settings:$(LocalIisVersion) is 10$(DestinationIisVersion) is 10$(UseIis) is True$(IisUrl) is http://localhost:55011/$(IncludeIisSettings) is true$(_DeploymentUseIis) is True$(DestinationUseIis) is True$(IisUrl_SiteID) is 77$(IisUrl_SiteFriendlyName) is Project$(IisUrl_SiteRelativePath) is /$(IisServer_IisAppPoolName) is Clr4IntegratedAppPool$(_Destination_IisServer_IisAppPoolName) is ASP.NET v4.0

Build machine with /p:IncludeIisSettings=false:

Package:
  Invoking Web Deploy to generate the package with the following settings:$(LocalIisVersion) is 10$(DestinationIisVersion) is 10$(UseIis) is True$(IisUrl) is http://localhost:55011/$(IncludeIisSettings) is false$(_DeploymentUseIis) is False$(DestinationUseIis) is False

And curiously, build machine with /p:IncludeIisSettings=true:

Package:
  Invoking Web Deploy to generate the package with the following settings:$(LocalIisVersion) is 7$(DestinationIisVersion) is 7$(UseIis) is True$(IisUrl) is http://localhost:55011/$(IncludeIisSettings) is True$(_DeploymentUseIis) is True$(DestinationUseIis) is True$(IisUrl_SiteRelativePath) is /

What is bothering me is that the LocalIisVersion is being set to 7 on the build machine with "/p:IncludeIisSettings=true". I have seen this, as stated above, on all of my build machines.

If I run the build with /filelogger /flp:Verbosity=Diagnostic, I see that e.g. LocalIisVersion is set multiple times. The first time it's set correctly, via registry lookup in the GetProjectWebProperties target in Microsoft.Web.Publishing.Targets. The second time is incorrect, indirectly via the MapUriToIisWebServer task (just a few lines down) setting the IisServer_IisMajorVersion output property to 7. This latter task is also not setting other missing items like IisUrl_SiteID, _FriendlyName, etc.

Looking online for information about MapUriToIisWebServer yields virtually nothing. As far as I can tell, it's not documented anywhere, so it's unclear what it should be doing or how it might fail. Does anyone have more information about this task?

FWIW, I have replicated the error on a build machine with the exact same version of Visual Studio, and maybe more importantly the exact same version of the Microsoft.Web.Publishing.Tasks.dll containing the MSBuild tasks used during the build.

I've spent the better part of 2 days trying to figure this out, and at this point I've basically given up and will either do the AppPool config by hand, or see if I can script it with Powershell. This seems like a failure though because clearly it should be possible to specify which AppPool to use as a parameter in the SetParameter file.


Viewing all articles
Browse latest Browse all 663

Trending Articles