Intro

We've had a few people complain of a particular error when installing and implementing the full source code version of the e-Commerce Framework.   The error goes something like this:   the directory '/publicstore/app_globalresources is not allowed because the application is precompiled'.   Nine times out of ten when an error makes mention of a pre-compilation issue this is because .cs files or .resx files have been included in a deployment version of the software.

Overview  

Most of you already know that Visual Studio compiles your C# code (and all other langauges supported by VS) into intermediate language (IL), this can be turned into native machine code to be executed by the Common Language Runtime (CLR).

The first compliation step when the code is turned into IL can be done when the page is first requested or it can be performed in advance.  When it is compiled in advance into IL this is called "precompiled" code.  The compiled file is now called an assembly.

The problem

A common mistake when upgrading from the distribution to fullsource code is to simply copy the fullsource version over the distribution while retaining the settings in the web.config files.   There is one critical problem here:   In the distribution, source files and .resx files are already in a precompiled state.   This means they are in assemblies (IL code).   When you bring your .cs or .resx files into this environment the compiler gets confused beacause it sees the .cs and .resx files and realizes that it needs to compile these into cache.   Which it will do, but now you have two sources for your code:  cache and your IL code and this causes the error(s).

An example:  The App_GlobalResources error   

I mentioned this error at the start of the article and I just want to briefly go over it here since this is the error that most commonly arises when dealing with a fullsource upgrade and is also a good example of the problem illustrated above.  

In the fullsource version of ECF you will notice a directory that is not included in the distribution:  It is the App_GlobalResources directory within the PublicStore.   This directory contains the .resx files in the eCommerce Framework which are used primarily for localization.  .resx files are still in a raw state meaning they are not compiled or even pre-compiled yet.   This is the reason they are not in the distribution, because the distribution contains no source or .resx files since the files in the distribution are already precompiled in advance.   When you include .resx files inside the public store, which would happen if you simply copy the full source over the distribution, you will have the same situation described above:  .resx files existing simutaneously with its own code in a precomplied state which will frustrate the CLR when attempting to access a page.

The solution:

To install the eCommerce Framework fullsource while already having the distribution on your computer it would be easiest to simply take these easy steps:

1)  Unzip the fullsource code to its own directory separate from the distribution.  This will avoid the problem of copying source files into the distribution where they will generate errors.

2)  Copy your distribution web.configs (public store, commerce manager, web services) over the web.configs of the fullsource version.   This will preserve your connections.

3) Open up the solution files for the front-end and back-end and build your solution.