GAC vs. DNN (Copy Local)
When developing in VS, if there is a bit of functionality that you would like to use, but do not have yet, you may go directly into the open-source commmunity to find the widget. However, this widget might have an installer, which puts the assemblies into the global cache (GAC). When you reference that code in your project and run your builds, you will likely not notice the references made to the GAC until you try to deploy your project onto a production server. When you do, your application may not be able to locate the resource. This leads to a very interesting discussion question and ensuing discussion -- When I build my projects, how do I make them fully portable with solutions referencing my local cache?
If you have run into this problem before, you might be thinking that the solution is very simple. Simply right-click on the reference in studio and set to "copy local." If configured correctly, when the VBE.exe command is run in studio (this happens when you Build, Rebuild) there will be a switch added to copy the codde out of the global cache into the local project to make it fully portable. Solved!
However, in the DNN world, all projects are developed within and then deployed into a framework which is a layer up from .NET. The signficance of this, from a development perspective, is more fully understood when we look at trying to have projects reference each other.
For example, if you wanted to add Functionality: F to the portal and have the Widget: W access it, the process would go like this:
- Develop and deploy F into the portal.
- Develop and deploy W, with a reference to F into the portal.
However, problem arises when W is being developed. Unless W and F are in a state of total solidarity, where it is known fully that no environmental factors that affect W will affect it apart from F, and vice versa, one cannot develop in the normative Visual Studio Strategy.
In the normal VS strategy, one would create a Solution, and add a new project F. Then W would be added and in W's reference, the F project would be referenced. Then upon deployment, both packages would have no problem communicating via their complied assemblies.
However, say you were working on a team of people who are working to establish a level of functionality beyond the scope of default portal modules, and you installed 5 different modules, all contributing to an overall strategy, but independent in their scope. You would either need to make everything one hugh solution, and limit yourself to working, one team member at a time, or you would need to make sure that if W references F, that the reference will transfer well.
So, all that mumbo jumbo stated, the basic reality comes down to solid practices of Assembly positioning:
DNN Site BIN
It is thus, crucially important that all functionality of modules contribute their code to the DNN root bin. I have a post that describes how to set up your modules to do this. This will make sure that at least the current portal you are working in is able to complete references appropriately.