Sitefinity embedded resources not refreshed during deployment

Make sure your Sitefinity embedded resources are being updated during deployment

  • September 3, 2019

The problem

Recently I was creating an Sitefinity MVC Widget inside an external assembly. A great way to create redistributable widgets or to separate your custom widgets from the main Sitefinity project. 

One thing you need to do when working with these external assemblies, is to mark all your resources (cshtml, js, css files etc.) as embedded resources. This way they are compiled into your .dll files and can be used by your application.

The problem I run into lately was that for some reason the changes in my new version of the assembly weren't reflected in the web application. I deleted some properties and the corresponding HTML in a widget designer, but after deployment they still were there. Nothing changed.

I used .NET Reflector to examine the .dll file to see if my changes were actually deployed, which indeed was the case.

Solution 1: rebuild and clean your project

Probably a good best practice is to rebuild your external project before deploying it, but in most cases this is something that will happen when you deploy a project manually or even through a CI/CD pipeline.

Solution 2: manually remove the cached files

After searching the internet I came across someone that actually had the same sort of problem and solved it by deleting all the caching files on the server. By default, when you compile a Web application the compiled code is placed in the Temporary ASP.NET Files folder. This folder is a subdirectory of the location where you installed the .NET framework.  

I have a script that removes those files for you, in case you are interested:

Credits for this script go to an unknown Progress community member :)

Solution 3: check / adjust your web.config

Chances are that you have for some reason adjusted this line inside your web.config file:

This line contains the optimizeCompilations attribute, which specifies whether dynamic compilation will recompile an entire site if a top-level file is changed. Top-level files include the Global.asax file and all files in the Bin and App_Code folders. If set to True, only changed files are recompiled.

Conclusion

For me the last solution was the solving my problem. Although my .dll file was changed and was placed inside the .\bin directory, it still didn't recompile the necessary files. So, changing it to false, caused a complete recompile of my website and this resulted in all the files being updated.


Image Description

Daniel Plomp

Entrepreneur, Senior Software Engineer .NET, Sitefinity Solution specialist, Orchard CMS enthusiast, Product Owner

All Author Posts

Got another minute? Check out:

Image Description

Call us

+31 (0) 36-2000196
Image Description

Email us

mail@zimplerconsulting.com
Image Description

Address

Grote Beer 57, 3893 DJ Zeewolde
NLThe Netherlands

Please sign in

Signin to manage your account.

Do not have an account? Signup

OR