我的 csproj 文件中有这个 msbuild 目标:
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' ">
<CreateItem Condition="'%(Extension)'=='.dll'" Include="@(ReferenceCopyLocalPaths)">
<Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
</CreateItem>
<Exec Command=""$(ProjectDir)..\..\..\tools\IlMerge\Ilmerge.exe" /targetplatform:"v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319" /ndebug /out:@(MainAssembly) "@(IntermediateAssembly)" @(IlmergeAssemblies->'"%(FullPath)"', ' ')" />
<Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
</Target>
这就像一个魅力。但我希望它排除特定文件并尝试对其进行调整:
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' ">
<CreateItem Condition="'%(Extension)'=='.dll' AND '%(Filename)' != 'Foo.dll'" Include="@(ReferenceCopyLocalPaths)">
<Output TaskParameter="Include" ItemName="IlmergeAssemblies" />
</CreateItem>
<Exec Command=""$(ProjectDir)..\..\..\tools\IlMerge\Ilmerge.exe" /targetplatform:"v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319" /ndebug /out:@(MainAssembly) "@(IntermediateAssembly)" @(IlmergeAssemblies->'"%(FullPath)"', ' ')" />
<Delete Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
</Target>
但是,这不起作用。有谁知道我做错了什么?