0

我正在尝试在 C# 项目文件中使用 ILMerge 将一些 dll 组合成一个 dll(出于各种原因)。我已经从https://github.com/loresoft/msbuildtasks下载了 MSBuild 社区任务,它的目标是 ILMerge。

尝试使用 ILMerge 目标时,我收到了这个晦涩的错误消息:

"C:\svn\AwaitingFeedbackCanceller.csproj" (rebuild target) (1) ->
(Zip target) ->
C:\svn\AwaitingFeedbackCanceller.csproj(150,5): error MSB6001: Invalid command line switch for "ILMerge.exe".
Value cannot be null.\r
C:\svn\AwaitingFeedbackCanceller.csproj(150,5): error MSB6001: Parameter name: path1

这些是我的项目文件中的相关位:

    <PropertyGroup>
    <ZipFileName>$(ProjectName)-$([System.String]::Copy('$(projectguid)').Trim('\{\}')).zip</ZipFileName>
    <MergedFile>$(ProjectDir)$(ProjectName).dll</MergedFile>
    <logFile>$(ProjectDir)$(ProjectName).log</logFile>
    <TargetPlatformVersion>v4</TargetPlatformVersion>
    <TargetPlatformDirectory>C:\Windows\Microsoft.NET\Framework64\v4.0.30319</TargetPlatformDirectory>
    </PropertyGroup>
  <ItemGroup>
    <inputAssemblies Include="$(ProjectDir)$(OutDir)$(AssemblyName).dll" />
    <inputAssemblies Include="$(ProjectDir)$(OutDir)AeriandiGeminiPluginBase.dll" />
    <allowDuplicates Include="$(ProjectDir)$(OutDir)ClassAB" />
    </ItemGroup>
    <Target Name="Merge">
    <Message Importance="high" Text="Merging assemblies" />
    <ILMerge InputAssemblies="@(inputAssemblies)" AllowDuplicateTypes="@(allowDuplicates)" OutputFile="$(MergedFile)" LogFile="$(logFile)" DebugInfo="true" XmlDocumentation="true" TargetPlatformVersion="$(TargetPlatformVersion)" TargetPlatformDirectory="$(TargetPlatformDirectory)" />
    </Target>

这真的开始阻碍我,因为我需要自动化多个项目的部署。

谁能指出我做错了什么?

干杯,

阿什利

披露:我也在 Github 上为这个项目添加了这个问题,但没有得到回应 - https://github.com/loresoft/msbuildtasks/issues/42

4

2 回答 2

1

为了让它工作,我必须安装 IlMerge MSI。我试图使用指定了 ToolPath 的 NuGet 版本,但由于某种原因它仍然找不到 IlMerge。

安装msi版本后,它工作正常。

http://www.microsoft.com/en-us/download/details.aspx?id=17630

于 2013-06-28T18:59:57.663 回答
0

我遇到了与您在上面描述的相同的问题,但是通过将此 ToolPath 添加到 ILMerge 任务的 NuGet 版本,我能够使其工作:

<ILMerge ToolPath="packages\ilmerge.2.13.0307" ...
于 2014-04-09T20:20:45.217 回答