How to exclude content folder link from nuget package

I have three referenced content folders from another project in my file .csproj:

 <Content Include="..\infrastructure\Content\**\*.*">
      <Link>Infrastructure\Content\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="..\infrastructure\fonts\**\*.*">
      <Link>Infrastructure\fonts\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="..\infrastructure\Scripts\**\*.*">
      <Link>Infrastructure\Scripts\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>

I want to create a package nugetfrom my project without content files included. I tried this command:

nuget pack sampleproj.csproj -Exclude ../infrastructure/** -NoDefaultExcludes -IncludeReferencedProjects -Verbosity detailed

But it includes the above files. I also tried these arguments for -Excludewithout success:

infrastructure/**
../../infrastructure/**
bin/infrastructure/**

When I use it **/infrastructure/**, it works, but also excludes some files that I need to package them.

How can I exclude links to content files?

PS : in my file .nuspcI have only one element file: <file src="cassette-cache\**" target="Content" />.

+4
source share

Source: https://habr.com/ru/post/1623916/


All Articles