Question

I am adding encryption to my build process for a public EPiServer site using MSBuild and aspnet_regiis. Mostly, it is going well, but not when encrypting the episerver tag in web.config.

The command:

aspnet_regiis -pef "episerver" "C:\Path\to\my\site" -prov "RsaProvider"

On my dev machine (where EPiServer is installed) it runs without problem, but on my build machine (where it's not installed), I get this:

Could not load file or assembly 'EPiServer.Configuration, Version=6.1.379.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7' or one of its dependencies. The system cannot find the file specified.

Other tags, like connectionStrings are getting correctly encrypted on the build server, so all the keys and access are in place.

My guess is that it is due to EPiServer not installed on the build server, but is it really necessary to install EPiServer to be able to encrypt web.config? I thought the encryption only would read the web.config and encrypt the text in selected tags?

Any tips on how to get my build server to encrypt the episerver tag in web.config would be appreciated.

Was it helpful?

Solution

When you install EPiServer it adds a number of dlls in the GAC, so that's why it works on your local machine and not on the build machine.

The section in the web.config is a custom configuration section (read more about them here (How to: Create Custom Configuration Sections Using ConfigurationSection) defined in the EPiServer.Configuration.dll. You can add that as a reference to your project (setting Copy Local to true), or you can simply install EPiServer on your build machine. I've done the latter, since the build machine then won't choke on any EPiServer dll whether or not you've added them to your project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top