But, following David Ebbo's recomendations, I decided to use
WebActivator to leave Global.asax untouched, so it's easier to add new adapters as they come without changing it. So, I included a file in the package at Content/App_Start/InstallCustomDataAnnotations.cs.pp with the following code:

So, this code needs a reference to system.web.mvc, which only makes sense in a MVC web app, but as my DTO.dll is also using DataAnnotations, it receives this code file and, of course, throws an error because of the dependency. I have the model in a separate
assembly because I want to reuse it in other projects like Windows Forms or mobile, so I don't need that reference to mvc.

My question would be: Can I specify anyway in the nuspec file that "Content/App_Start/InstallCustomDataAnnotations.cs.pp" only applies to Web Application projects, and not to Code Library projects? May this be a new feature?

You can't do that today, you could make separate packages or write some powershell to make it work in each case the way you want it to.

Thanks for answering, David.

I thought about that: making two separate packages -> DataAnnotations.Web (with web activator) and DataAnnotations.DLL (without it), but I discarded it because Nuget would install both on the Web project because of the dependencies: