I am making a new DXA project in Visual Studio, starting from an empty MVC solution. I've added the DXA assemblies with Nuget, but the SDL.Web.Tridion.dll assembly is not part of the Nuget package, but the Unity configuration file references it.

What is the cleanest and best way to include the SDL.Web.Tridion.dll file in the project? And, why is it not part of the DXA 1.7 Nuget package, since it seems to rely on it.


With "the DXA 1.7 Nuget package" I'm guessing you mean "SDL Digital eXperience Accelerator Framework for SDL Web 8", which when you inspect the contents of the package, does contain the SDL.Web.Tridion.dll in its lib\net452 directory.

The reason it is not referenced from a Web project, is because of clarity on dependencies. a Web project (see https://github.com/sdl/dxa-web-application-dotnet/blob/release/1.7/Site/DxaWebApp.csproj) references Sdl.Web.Common.dll and Sdl.Web.Mvc.dll, and the latter has a reference to SDL.Web.Tridion.dll. The web project itself should never have a direct reference to SDL.Web.Tridion.dll (since in DXA we abstract the Tridion API away to make it a more standard MVC application, easier to understand for Web developers, so they don't need Tridion API knowledge).

The cleanest and best way to include the required DXA framework libs in your project can again be found in our example project: https://github.com/sdl/dxa-web-application-dotnet/blob/release/1.7/Site/DxaWebApp.csproj, it contains a target BeforeBuild:

<Target Name="BeforeBuild">
    <CallTarget Targets="CopyDxaFrameworkLibsToOutput" />

The NuGet package will contains further details about that target and what it does, but simply put, it copies the SDL.Web.Tridion.dll DLL to the bin directory of your project before build.

All of this is also covered in the documentation under the topic "Setting up a new ASP.NET MVC Web application".

note: I'm wondering once you are done with your new DXA project, how "different" it will be compared to the example project which DXA already provides you, would gladly receive some feedback as to why you think the example is not usable for you.

| improve this answer | |
  • Thanks Bart. It's not so much to be "different", but to know 100% what the dependencies are and to know exactly what is in the solution - and why. I was missing this info in the online documentation but thanks to your answer it is more clear now. Much appreciated. – robrtc Jul 17 '17 at 19:38
  • Nice explanation! Small correction: Sdl.Web.Tridion.dll is not referenced from any assembly; it is only referenced in Unity.config and thus loaded at runtime (there is a runtime dependency). Because there is no compile-time dependency, standard MSBuild targets don't take care of copying the DLL to output and hence the CopyDxaFrameworkLibsToOutput target is needed. – Rick Pannekoek Jul 21 '17 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.