Skip to content
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

Allow use of configBuilders in Web.config file for .NET deployments on Windows #335

Open
nikhil-aws opened this issue Aug 3, 2024 · 0 comments
Labels

Comments

@nikhil-aws
Copy link

nikhil-aws commented Aug 3, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or "me too" comments. They generate extra noise for issue followers and do not help prioritize the request.

Tell us about your request
What do you want us to build?
→ Allow use of configBuilders in Web.config file for .NET deployments on Windows

Is this request specific to an Elastic Beanstalk platform?
If so, which one(s)?
→ Yes, Windows platforms

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
What outcome are you trying to achieve, ultimately, and why is it hard/impossible to do right now? What is the impact of not having this problem solved? The more details you can provide, the better we'll be able to understand and solve the problem.

→ .NET deployments fail when using configBuilder in app settings in Web.config files.

System.Runtime.InteropServices.COMException (0x8007000D): Filename: \\?\C:\inetpub\wwwroot\web.config Line number: 18 Error: Unrecognized attribute 'configBuilders'

Are you currently working around this issue?
How are you currently solving this problem?

→ Please follow the below steps:

  1. The first step is to split out the contents of into a separate file, called appsettings.config and make the contents like so:

appsettings.config:

<appSettings configBuilders="Env">
    <add key="webpages:Version" value="3.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    <add key="NetZipCode__User" value="Unset"/>
    <add key="NetZipCode__Key" value="Unset"/>
</appSettings>
  1. Then in the Web.confg file, just have an empty as follows:

Web.confg:

  <appSettings>
  </appSettings>
  1. Finally, create an ebextension configuration file like this to create a post deploy hook to overwrite the appSettings after deployment:

.ebextensions/configure_appsettings.config:

files:
 "C:\\eb_setup\\9999_configure_appsettings.ps1":
   content: |
    (Get-Content C:\inetpub\wwwroot\Web.config).Replace("<appSettings>", "<appSettings configSource='appsettings.config'>") | Set-Content C:\inetpub\wwwroot\Web.config

container_commands:
  00_move_hooks:
    command: powershell -command "Move-Item -Path C:\eb_setup\9999_configure_appsettings.ps1 -Destination 'C:\Program Files\Amazon\ElasticBeanstalk\hooks\appdeploy\post\9999_configure_appsettings.ps1' -Force"
  01_cleanup:
    command: powershell -command "Remove-Item -Recurse C:\eb_setup\ -Force"

Please create a .ebextensions at root location in your source application bundle.

Additional context
Anything else we should know?

→ This issue has been created for external tracking purpose.

Attachments
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant