Skip to content

RC2 Visual Studio publish writes its own Web.Config #1562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glent1 opened this issue Jun 9, 2016 · 6 comments
Closed

RC2 Visual Studio publish writes its own Web.Config #1562

glent1 opened this issue Jun 9, 2016 · 6 comments

Comments

@glent1
Copy link

glent1 commented Jun 9, 2016

I have a web.config in the root of my web project that has some application specific settings. This is not the web.config that gets populated into the publish folder, which seems to be entirely dynamically created. Is there any way to control this?

@ShadowDancer
Copy link

Are you sure? In my case variables like %LAUNCHER_PATH% are replaced, but custom settings like:

<customHeaders>
      <remove name="X-Powered-By" />
</customHeaders>

Are presisted into published config.

@glent1
Copy link
Author

glent1 commented Jun 9, 2016

I'm positive - I lose an entire "security" section.

@moozzyk
Copy link
Contributor

moozzyk commented Jun 9, 2016

@glent1 - did you upgrade your application from RC1? If you comment out postpublish scripts does the web.config look fine after publishing?
If not, can you provide a repro/create a git repo with your app so that I can look at it and see what is happening?

@SimonOrdo
Copy link

Ad I understand it, the publish process does edit the web.config a bit to help IIS find/run the app.

Like @glent1 said, try removing this bit and see if it re-writes the config:

"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]

@glent1
Copy link
Author

glent1 commented Jun 10, 2016

I did indeed convert it from RC1. And Beta8, Beta7 etc. The suggestion to remove the postpublish script lead me to the real problem - I wasn't explicitly including the web.config in the publishOptions include list. I had previously compared a clean project to mine and made the updates manually and had obviously missed this one. Thanks for the help guys.

@glent1 glent1 closed this as completed Jun 10, 2016
@moozzyk
Copy link
Contributor

moozzyk commented Jun 10, 2016

Yeah - that's why I asked. There are some gotchas when moving from RC1 to RC2. In this case publish-iis did not find web.config and create a new one for you. I think publish-iis actually prints a message when it happens. Found it: https://github.com/aspnet/IISIntegration/blob/dev/src/Microsoft.AspNetCore.Server.IISIntegration.Tools/PublishIISCommand.cs#L48

@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants