Issue I ran into when using Nuget/SlowCheetah

nugetCannot add part to the package. Part names cannot be derived from another part name by appending segments to it

Last week I ran into an issue where I was using nuget to package a .csproj file.
What I was after was the contents of the nuget package to contain a Content folder and inside this Content folder have one file called app.config.transform, that’s it.

If my .csproj file contained the following:-

[sourcecode language=”xml”] <PropertyGroup Label="SlowCheetah">
<SlowCheetahTargets>..\.shared\SlowCheetah.Transforms.targets</SlowCheetahTargets>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(SlowCheetahTargets)" Condition="Exists(‘$(SlowCheetahTargets)’)" Label="SlowCheetah" />
[/sourcecode]

Then the package contents had a single file called content – which is incorrect.

The way I fixed this was inside the .csproj file I changed the type of the app.config.transform from Content to None. I then changed my .nuspec file to have the following:-

[sourcecode language=”xml”] <files>
<file src="App.config.transform" target="Content" />
</files>
[/sourcecode]

This fixed my issue with the contents of my nuget package, just incase anyone runs into the same issue.