sayedihashimi / package-web

Extensions for ASP.NET web projects package creation
32 stars 18 forks source link

Variable substitution is not working for app_data #76

Open rmagruder opened 9 years ago

rmagruder commented 9 years ago

IIS Web Application Name isn't getting substituted when setting ACL's. It is saying unrecognized {IIS Web Application Name}. I end up having to manually type that in during the run of the interactive publish powershell script.

sayedihashimi commented 9 years ago

@rmagruder thanks for the report. Can you include some steps so that I can reproduce the issue? With the current info I don't have enough to try out exactly what you are seeing.

rmagruder commented 9 years ago

Building a web service that has an APP_DATA folder which has stuff that has to be deployed. I build and deploy, and run the interactive deploy.

IIS Web Application Name: Default Web Site/MySiteName new value> Add write permission to App_Data Folder: {IIS Web Application Name}/App_Data new value>

Now, if I Just hit here to accept it:

Info: Updating file (Default Web Site/MySiteName\Web.config). Info: Object dirPath (websiteDeploy) skipped due to skip directive 'CommandLineSkipDirective 1'. Info: Object dirPath (website_Package) skipped due to skip directive 'CommandLineSkipDirective 3'. Info: Adding ACL's for path (Default Web Site/MySiteName) Info: Adding ACL's for path (Default Web Site/MySiteName) Info: Adding ACL's for path ({IIS Web Application Name}/App_Data) Error Code: ERROR_SITE_DOES_NOT_EXIST More Information: Site '{IIS Web Application Name}' does not exist. Learn more at: http://go.microsoft.com/fwlink/?Link Id=221672#ERROR_SITE_DOES_NOT_EXIST. Error count: 1.

As you can see, when it came to App_Data, the site didn't get substituted?

The Parameters.xml in the project folder contains the appropriate Key/Value pair, so I just don't understand why it messes up trying to add ACL's for the App_Data subfolder?

rmagruder commented 9 years ago

Hi, sorry for the long layover, been working on other things. I did some single step debugging of publish-interactive.ps1. Looks like the bracketed variable name is emitted into the parameters file by on the build-side of package-web, not the part where the publish happened. By the time publish-interactive.ps1 sees the {IIS Web Application Name}/App_Data, it is getting this from the parameters file that was built. So, I'm guessing the problem is a fail to do the subsitution at build time.

Side note: In general, I think the biggest issue I'm having is how finicky the parameters are at publish time, So much so, that I am trying to think of a way to simplify things for the people doing the deployments. The only two parameters I think my deployers should care about are the name of the config transform and the target server (without any Default Web Site/msdeploy.axd?....) stuff. So just "Sqa" and "MySqaServer" with everything else 'just working', but because of how finicky the server name is, and the fact that all the other parameters, such as authentication, app_Data path name, etc and even connection string (!) need to be specified, it seems that file based config is preferred, even though it's more error prone (what if you left the wrong config.ps1 file laying there from a previous deploy and then run the script -- deployed to the wrong place!)