bug: failure to return the correct physicalPath value #443
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I found what appears to be a bug, that being a failure to return the correct physicalPath value
(e.g. the incorrect value of 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0', vs. the correct value of 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0*1.0*'). The Deploy function assumes that the value of in the btdfproj file should determine the location of the directory for a web application's content. is first used for constructing the MSI, enabling it to locate the web application content relative to the BTDF solution/project. It does not follow that the value would correlate to the location where web application content is installed by the MSI.
I observed that when my application was installing to the folder 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0*1.0*', the web application being deployed in IIS pointed to the wrong folder, 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0'. The problem was caused by the btdfproj file's element having a value of '....\EAICore_Proxy', and the fact that when the MSI is installed the current directory of MSBuild execution is the Deployment directory, 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0\1.0\Deployment'. The element value of '....\EAICore_Proxy' is resolved to an absolute path, and then used as the directory for the web application. In my test case, the result was a path that was one level too far up the path tree.
The submitted remediation for bug this breaks the assumption that determines the location of the directory of the web application. Instead, the directory containing the web application is searched for. However, in an effort to not break MSI installation progress, the remediation approach will default to using the value of physical path if the name of the web application folder cannot be found. Additionally, a warning is logged. The user may manually correct the web application folder location in IIS.
fix: Added a function, FindWebApplicationPath, that finds the correct physicalPath (e.g. 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0*1.0*\EAICore_Proxy')
given a starting point (e.g. 'C:\Program Files (x86)\EAI_Core for BizTalk 1.0.0\1.0\Deployment')
and the physicalPath value from the btdfproj file (e.g. '....\EAICore_Proxy').