我正在尝试创建一个dotnet new包含我的团队使用的“默认”.editorconfig 和 .gitconfig 的简单模板。
不幸的是,.files 不会被包含在dotnet pack.
这是我的 .csproj 的一部分:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageType>Template</PackageType>
<TargetFramework>net6.0</TargetFramework>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
</PropertyGroup>
<PropertyGroup>
<Description>dotnet new templates</Description>
<PackageTags>template dotnet console</PackageTags>
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="**\*" />
<Content Include="templates\**\*" Exclude="templates\**\bin\**;templates\**\obj\**;templates\**\.vs\**" />
<Content Include="templates\SolutionTemplate\.editorconfig;templates\SolutionTemplate\.gitignore" Pack="true" />
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
尽管已明确添加,但 .editorconfig 和 .gitignore 将被忽略。有人有这方面的经验吗?