如何在Nuget中排除内容目录
我正在尝试使用我的CSPROJ和MSBUILD构建Nuget。 Nuget软件包成功创建了。但是我看到内容和contentFiles文件夹,其中包含我的 20 .proto文件。 当有人下载我的nuget时,他们也会得到我的原始文件。但是我不想给那些文件。如何避免使用.proto文件。
我没有.nuspec文件。
我的csproj看起来像这样:
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
<PackageId>BlahBlah</PackageId>
<Title>BlahBlah</Title>
<Version>1.0.0</Version>
<Authors>Test</Authors>
<Company>Test</Company>
<PackageTags>Test nuget</PackageTags>
<DebugType>portable</DebugType>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageOutputPath>Blah</PackageOutputPath>
</PropertyGroup>
<Target Name="Test1" AfterTargets="Pack" Condition="$(PackOnBuild) == 'true'">
<ItemGroup>
<PackageFile Include="$(TestVersion).nupkg" />
</ItemGroup>
<Copy SourceFiles="@(src)" DestinationFolder="$(dst)" />
</Target>
I am trying to build nuget with my csproj and MSBuild.
Nuget package gets created successfully. But I see content and contentFiles folder where it has my 20 .proto files.
And when someone downloads my nuget, they also get my proto files. But I don't want to give those files. How Can I avoid having .proto files.
I don't have .nuspec file.
My csproj looks like this :
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ProduceReferenceAssemblyInOutDir>true</ProduceReferenceAssemblyInOutDir>
<PackageId>BlahBlah</PackageId>
<Title>BlahBlah</Title>
<Version>1.0.0</Version>
<Authors>Test</Authors>
<Company>Test</Company>
<PackageTags>Test nuget</PackageTags>
<DebugType>portable</DebugType>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<PackageOutputPath>Blah</PackageOutputPath>
</PropertyGroup>
<Target Name="Test1" AfterTargets="Pack" Condition="$(PackOnBuild) == 'true'">
<ItemGroup>
<PackageFile Include="$(TestVersion).nupkg" />
</ItemGroup>
<Copy SourceFiles="@(src)" DestinationFolder="$(dst)" />
</Target>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据,您可以设置
&lt; pack&gt; false&lt;/pack&gt;
从Nuget软件包中排除文件。由于我不知道
proto
文件被视为content
或none
,它应该是csproj 代码>。
According to the Microsoft docs, you can set
<Pack>false</Pack>
to exclude files from the NuGet package.Since I don't know whether
proto
files are treated asContent
orNone
, it should be eitheror
within the
csproj
.