2013-04-24 3 views
4

BeforeBuild를 실행해야하는 .csproj 파일에 다음 인라인 작업이 정의되어 있습니다. VS2012에서 프로젝트를 빌드 할 때MSBuild가 DLL을 작업에 참조합니다.

<UsingTask TaskName="VersioningTask" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> 
<ParameterGroup> 
    <FileName ParameterType="System.String" Required="true" /> 
    <XmlFileName ParameterType="System.String" Required="true" /> 
</ParameterGroup> 
<Task> 
    <Reference Include="System.Xml.dll" /> 
    <Reference Include="System.Xml.Linq.dll"/> 
    <Using Namespace="System" /> 
    <Using Namespace="System.IO" /> 
    <Using Namespace="System.Linq" /> 
    <Using Namespace="System.Text" /> 
    <Using Namespace="System.Text.RegularExpressions" /> 
    <Using Namespace="System.Xml.Linq" /> 
    <Code Type="Fragment" Language="cs"><![CDATA[ 
     var xDoc = XDocument.Load(XmlFileName); 
     //... 

나는 다음과 같은 오류 얻을 : 나는 XML 물건과 두 개의 참조를 제거하면

Could not find reference "System.Xml.dll". If this reference is required by your code, you may get compilation errors.

Could not find reference "System.Xml.Linq.dll". If this reference is required by your code, you may get compilation errors.

를 빌드가 성공합니다. 나는 DLL (% windir %/assembly)에 대한 전체 경로를 아무런 성공없이 사용하려고했습니다.

어떤 아이디어가 잘못 되었습니까?

답변

10

System.Xml.Linq를 참조 할 때 똑같은 문제가 발생했습니다. 컴파일 된 작업으로 전환해도 솔루션은 해결되지만 원본 코드를 인라인 작업으로 구현하려면 파일 이름이 아닌 루트 네임 스페이스를 참조하도록 참조부터 인라인 작업까지 파일 확장명을 삭제하면됩니다.

변경이 :

<Reference Include="System.Xml.dll" /> 
<Reference Include="System.Xml.Linq.dll"/> 

읽기 :

<Reference Include="System.Xml" /> 
<Reference Include="System.Xml.Linq"/> 
+3

감사합니다, 인라인 작업에 MSDN 페이지 (http://msdn.microsoft.com/en-us/library/dd722601. aspx) 잘못 끝에 .dll이 포함됩니다. – makhdumi

-1

인라인 작업을 사용하는 대신 일반 작업을 사용하여 해결했습니다.

관련 문제