In ASP.NET, we have Application Settings, and we have Application Pre/Post Build Events. Is it possible to access a Setting from the Pre Build Event? Or is it possible to inject the value of a Setting from the Pre Build Event?
Full context:
I have an Angular app embedded in an ASP.NET 4 Web API app. That is, my app is structured like this:
+ Solution
| - Project
| + Properties
| + AngularApp
| | + dist
| | + e2e
| | + src
| | - (etc)
| + App_Start
| + Model
| + Global.asax
| - Web.config
- ProjectTest
I have some URL rewrite rules so that any request website.com/x that doesn't refer to one of my Controllers will instead be redirected to website.com/AngularApp/dist/AngularApp/x. Everything I've described so far is working great.
The trouble is, this app is not being deployed to the root of the domain; it's being deployed to a subdirectory of the domain. (i.e. website.com/app instead of website.com). Three different portions of my app need to know that this new subdirectory should be considered root - the Angular app needs to have this configured as root, the rewrite rules need to incorporate this, and a certain pieces of C# code also needs to know about this new root (I'll save you the details here). Currently, I've had to specify this subdirectory in both the Pre Build Events (which are building the Angular app) and the Web.config (which controls my rewrite rules) and the Settings (which are accessed by my aforementioned C# code). It'd be better if I could have a single configuration that they all pulled from. My above question would at least allow the combination of two of these disparate three configurations.