I am attempting to follow these instructions to perform a simple XML transform on a target App.config file via a custom NuGet package.
The app.config.transform
file contains the following content:
<configuration>
<appSetttings>
<add key="foo" value="bar" />
</appSetttings>
</configuration>
The .nuspec
file contains the following content:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Foo.Bar</id>
<version>1.0.0</version>
<title>Foo Bar</title>
<authors>Foo</authors>
<description>Bar</description>
</metadata>
<files>
<file src="app.config.transform" target="content" />
</files>
</package>
This correctly inserts the file into the content
folder in the .nupkg
file when running nuget pack
.
In Visual Studio 2017 (15.6.4) when adding the NuGet package to a brand new Console Application with an existing vanilla App.config
file, no transforms take place (i.e. the content of App.config
is unchanged). This is also the case with XDT transforms.
Can anybody advise why the transformation fails to take place?
UPDATE
I am using PackageReference as my package management format in the target .NET Framework 4.7.1 project.