2011-12-02 2 views
0

ILMerge를 사용하여 여러 어셈블리를 하나의 플러그인 어셈블리로 병합하려고합니다.이 어셈블리는 다른 응용 프로그램에서 동적으로로드됩니다. @ (_ ResolvedProjectReferencePaths)를 사용하여msbuild에서 해결 된 참조 경로 목록 얻기

<Target Name="CombineAssemblies" AfterTargets="MvcBuildViews"> 
    <ItemGroup> 
     <MergePaths Include="@(_ResolvedProjectReferencePaths)" /> 
     <!--<MergePaths Include="%(Reference.ResolvedPath)" /> This doesn't work! --> 
    </ItemGroup> 

    <ILMerge 
     DebugInfo="true" 
     LogFile="log.txt" 
     InputAssemblies="@(MergePaths)" 
     OutputFile="&quot;$(TargetPath)&quot;" 
     CopyAttributes="true" 
     TargetPlatformVersion="v4"/> 
</Target> 

프로젝트 참조에 대한 잘 작동, 그 경로는 ILMerge 작업을 통해 제대로 passesd 있습니다 : 커뮤니티 작업을 사용

는, 내가 지금까지 가지고있다.

MSBuild를 통해이를 실행하면 ILMerge.exe 오류가 발생합니다. 로그 파일을 보면, 내가 얻을 :

Unresolved assembly reference not allowed: System.Web.Mvc. 
    at System.Compiler.Ir2md.GetAssemblyRefIndex(AssemblyNode assembly) 
    at System.Compiler.Ir2md.GetTypeRefIndex(TypeNode type) 
    at System.Compiler.Ir2md.VisitReferencedType(TypeNode type) 
    at System.Compiler.Ir2md.VisitMethod(Method method) 
    at System.Compiler.Ir2md.VisitClass(Class Class) 
    at System.Compiler.Ir2md.VisitModule(Module module) 
    at System.Compiler.Ir2md.SetupMetadataWriter(String debugSymbolsLocation) 
    at System.Compiler.Ir2md.WritePE(Module module, String debugSymbolsLocation, BinaryWriter writer) 
    at System.Compiler.Writer.WritePE(String location, Boolean writeDebugSymbols, Module module, Boolean delaySign, String keyFileName, String keyName) 
    at System.Compiler.Writer.WritePE(CompilerParameters compilerParameters, Module module) 
    at ILMerging.ILMerge.Merge() 
    at ILMerging.ILMerge.Main(String[] args) 

내가 로그 파일에서 내가 가정합니다 MVC 라이브러리를 참조하고있어 그들이이 실제 컴파일 과정에서 제대로 해결 된 경우에도, ILMerge에 의해 해결 될 수 없습니다.

따라서 ILMerge를 통해 이상적으로 References 항목을 사용하여 이러한 라이브러리의 위치를 ​​전달하고자하므로 참조를 추가하거나 제거하면 변경해야 할 참조 경로를 수동으로 추가 할 필요가 없습니다. 정상적인 참조에 대해 @ (_ ResolvedProjectReferencePaths)와 동일한 기능이 있습니까?

감사합니다.

답변

2

ResolveAssemblyReferences 대상 다음에 사용해야하는 @ (ReferencePath)를 사용합니다.