blipson89 / Synthesis

Synthesis is a universal object mapper for Sitecore
MIT License
75 stars 25 forks source link

PackageReference usage for Synthesis NuGet causes incorrect deployment for config files. #87

Closed rroman81 closed 3 years ago

rroman81 commented 4 years ago

Do you want to request a feature or report a bug? bug

What is the current behavior? Using PackageReference for Synthesis v9.1.0.2 in .Net 4.8 Web Project causes the files under contentFiles/any/any/Synthesis..config to be deployed to obj/debug/PackageTmp/ root instead of App_Config/Include/Synthesis sub-folder.

If the current behavior is a bug, please provide the steps to reproduce. Web Project templates utilizes PackageReferences for NuGet dependencies. Added Synthesis v9.1.0.2 to through Package Manager UI.

What is the expected behavior? NuGet definition should be outputing the files into correct deployment folder structure under App_Config.

Please mention your Sitecore version and Synthesis version. I am using Sitecore 9.2 with Synthesis 9.1.0.2

blipson89 commented 4 years ago

This is a known limitation of PackageReference on Web projects. contentFiles just flat out aren't supported for some reason. https://devblogs.microsoft.com/nuget/nuget-contentFiles-demystified/ (see "Supported Project Types")

The NuGet package is in the correct format according to NuGet specifications, and it should work perfectly fine in a class library project.

My recommendation is to either:

  1. Install it onto a class library project
  2. Explicitly add the config files from the package to your solution in App_Config/Modules/Synthesis

2 is what I do on my projects. Microsoft doesn't appear to be treating it as a bug and I don't think there are plans to fix it.