0

I understand the purpose of razor class libraries, but I'm just wondering - I have a .NET Core 3.0 website that has a few referenced RCLs, if I make changes to the .cshtml in one of those RCLs and publish from the website level, it will show that change as an update (as expected). My question is: is it possible to setup a razor class library so I can publish only from there (i.e. right click\publish an individual file, or use the Web Publish Activity tab to publish individual files quickly up to my website). I'm quite surprised that this doesn't seem to work out of the box: surely there must be a way.

Thanks!

1 Answer 1

1

RCLs produce a DLL. All the views are embedded in that DLL. Technically, then, the DLL that's produced from building the RCL can be copied over, since this is all that's changing anyways.

However, hot-swapping DLLs, views, etc. has always been an anti-pattern. If you make a change, that should be accompanied by a complete redeployment of the entire application, since nothing exists in isolation. The RCL, itself, might build, for example, but the application could fail with that new version included. Only by publishing the entire application with all included components can you know that everything is actually working correctly in an integrated way.

Additionally, you should really have a CI/CD pipeline to condition your releases on successful builds and tests. If you are using a CI/CD pipeline, you don't have a choice but to do a full deploymenet, so the question becomes moot.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.