5

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.

1 Answer 1

8

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" />
</Target>

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.

3
  • 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
    Commented Jul 17, 2017 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. Commented Jul 21, 2017 at 15:54
  • The problem here is if you want to extend/customise the DefaultContentProvider in some way. You now need to add it as a reference in order to do that.
    – Neil
    Commented Sep 29, 2020 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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