Modify static content without new build

We have been using Razor but we don’t use any of its features really and building and starting the app for changes in the front end is a huge productivity drag. We’d like to be able to modify content pages without doing that.

We’ve also tried just having a separate project and framework but getting back to the rest calls via CORS and Auth was pretty cumbersome considering we don’t need that in prod.

So my question is what approach makes it possible to have service stack serve static content that exists both in the project root folder -OR- in \bin. This would allow us to edit “in place” the static files during development without having to build and restart the app for those changes, yet maintain the ability to have it all in the base project and be built.

Open to other ideas as well.

ASP.NET Web Projects

If this is an ASP.NET Web App, in DebugMode already lets you Modify Razor pages and have changed picked up without needing to rebuild/restart your project.

Self-Hosted Razor Projects

If this is a self-hosted App you can change your physical root path to point to your project folder so it looks at your project source files instead of the files copied and hosted from your /bin folder, e.g:

SetConfig(new HostConfig {
    DebugMode = true,
    WebHostPhysicalPath = "~/../..".MapServerPath(),

Single Page App Templates

Otherwise my personal preference is to develop Single Page Apps where the UI is served from a static default.html or default.cshtml and all changes are made in TypeScript which VS.NET compiles to JavaScript on save so you get live reload functionality without needing to rebuild/restart the project by just saving the TypeScript source (.ts) or JSX files (.tsx) and reloading the page.

Most of ServiceStackVS’s Single Page App VS.NET Templates has this development experience. We’ve also published a step-by-step TypeScript, React and Redux guide that’s useful if you’re new to React.

1 Like

Oops should have clarified, we develop on Mac, using Xamarin / Mono, production is IIS/azure web app. DebugMode didn’t pickup automatically with Xamarin’s XSP server but I did the SetConfig and that appears to be working now.

Many thanks!!

PS: Xamarin does not support typescript… yet…

1 Like

Looks like you can use the TypeScript AddIn, otherwise you can run TypeScript watch mode which will watch TypeScript source files for changes and automatically compile them in the background.

Thanks I saw that, that particular plugin in not being maintained actively and does not work in the newer versions of Xamarin studio.

For typescript, upon further investigation, looks like Debug mode is really not dependent on IDE so we can use Webstorm (which is better anyway for front end than Xamarin) attached to our project folder and it also supports typescript so I think we are golden on that front too.

1 Like