I am creating a NuGet package and I need to include some cs files and hope their namespace can auto transform to the target project's namespace. So I found the document said that I need to use .pp and replace the origin namespace to $rootname$. But when I publish this package, the target project not showing the Test.cs file in it, What am I missing?
Here are my Test.cs.pp, nuspec and nupkg screenshot
Test.cs.pp:
using $rootnamespace$.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace $rootnamespace$.Entities
{
public class Test
{
public LogTypeEnum LogType { get; set; }
[StringLength(60)]
public string ClientIP { get; set; }
[StringLength(512)]
public string Method { get; set; }
public string Params { get; set; }
public string Message { get; set; }
public string Exception { get; set; }
}
}
nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package >
<metadata>
<id>$id$</id>
<version>1.0.51</version>
<title>$title$</title>
<authors>Nicky</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<!--<projectUrl>http://project_url_here_or_delete_this_line/</projectUrl>
<iconUrl>http://icon_url_here_or_delete_this_line/</iconUrl>-->
<description>Test</description>
<releaseNotes>test</releaseNotes>
<copyright>$copyright$</copyright>
<dependencies>
<group targetFramework=".NETCoreApp3.1">
<dependency id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="7.0.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Identity.EntityFrameworkCore" version="3.1.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Identity.UI" version="3.1.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.EntityFrameworkCore" version="3.1.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.EntityFrameworkCore.SqlServer" version="3.1.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.EntityFrameworkCore.Sqlite" version="3.1.2" exclude="Build,Analyzers" />
<dependency id="Newtonsoft.Json" version="12.0.3" exclude="Build,Analyzers" />
</group>
</dependencies>
<frameworkReferences>
<group targetFramework=".NETCoreApp3.1">
<frameworkReference name="Microsoft.AspNetCore.App" />
</group>
</frameworkReferences>
<contentFiles>
<!-- Include Assets as Content -->
<files include="**/images/*.*" buildAction="EmbeddedResource" />
<files include="cs/**/*.*" buildAction="Compile" />
<files include="pp/**/*.*" buildAction="Compile" />
</contentFiles>
</metadata>
<files>
<!--<file src="contentFiles\**" target="contentFiles" />-->
<file src="Entities\*.cs" target="contentFiles\cs\any\Entities" />
<file src="Entities\*.pp" target="contentFiles\cs\any\Entities" />
</files>
</package>
and nupkg: