The answer, as it turns out, is to put the xml file in as a "content" and then use an install.ps1 script in the nuget "tools" directory to set the file to "Copy To Output". The important thing to note is that this script only gets executed in visual studio, so any content files must be checked in/source controlled, so that any build server has the content files when the server checks it out. A small but incredibly important detail!!
The script I use to set the content files as copy to output:
param($installPath, $toolsPath, $package, $project)
function SetFilePropertiesRecursivelyByFolderName
{
$folderKind = "{6BB5F8EF-4483-11D3-8BCF-00C04F8EC28C}"; #Physical Folder
foreach ($subItem in $args[0].ProjectItems)
{
$path = $args[1]
if ($subItem.Kind -eq $folderKind)
{
SetFilePropertiesRecursively $subItem ("{0}{1}{2}" -f $path, $args[0].Name, "\")
}
else
{
Write-Host -NoNewLine ("{0}{1}{2}" -f $path, $args[0].Name, "\")
SetFileProperties $subItem 2 2 ""
}
}
}
function SetFileProperties
{
param([__ComObject]$item, [int]$buildAction, [int]$copyTo, [string]$customTool)
Write-Host $item.Name
Write-Host " Setting Build Action to Content"
$item.Properties.Item("BuildAction").Value = $buildAction
Write-Host " Setting Copy To Output Directory to Copy if newer"
$item.Properties.Item("CopyToOutputDirectory").Value = $copyTo
Write-Host " Setting Custom Tool to blank"
$item.Properties.Item("CustomTool").Value = $customTool
}
function SetIndividualFileProperties
{
param([string]$fileName)
Write-Host $fileName
$file1 = $project.ProjectItems.Item($fileName)
$file1.Properties.Item("CopyToOutputDirectory").Value = 2
$file1.Properties.Item("BuildAction").Value = 2
}
#SetFilePropertiesRecursivelyByFolderName $project.ProjectItems.Item("FolderName")
#SetIndividualFileProperties "FileName.ext"
EDIT
As it was pointed out that folderKind wasnt very clear (the guid or purpose at least), there is a link on microsoft site for the list of supported visual studio guids that define sln/project structures i.e. for physical file/folders and many other elements. This can be found here: https://learn.microsoft.com/en-us/visualstudio/extensibility/ide-guids?view=vs-2017
This information is mostly unnecessary as the script above should work as is, but provided for further reading/background material!