When creating a new DXA (1.7) Web Application we can use DXA Core sample website to get started or we can start fresh, and build it from ground up using the NuGet packages. In a recent project we wanted to start fresh, only using the framework itself and not any of the samples provided OOTB. While some may say we lose the ‘acceleration’ by taking this path, others could argue that in most client applications they prefer to have a clean solution where they know what all the code does, and why, and have no extra stuff that is not needed or used inside. So, anyways, we decided to take the high road and start from a ‘file, new project’ approach. It hasn’t been easy, but it’s been real.
While making the new project you will have almost everything you need – except for one very important and not included DLL – the SDL.Web.Tridion.dll file. This is referenced from the Unity IoC container…and you can see it in the Unity.config file. It is not referenced in the project references. When you don’t have this file in the /bin folder, you will get the following error message:
The type name or alias DefaultCacheProvider could not be resolved. Please check your configuration file and verify this type name.
The solution is quite simple, but can be deceiving. The DXA Sample Project .csproj file includes a very important command to tell the project to copy the DLL.
<Target Name="BeforeBuild"> <CallTarget Targets="CopyDxaFrameworkLibsToOutput" /> </Target>
In your own .csproj file, copy the above config anywhere on the top level. I placed mine before the final closing </Project> tag. Now, re-open the project in Visual Studio and build, and you should see the friendly SDL.Web.Tridion.dll file in the bin folder and your website will be happy again.