locked
Problem with predefined task RRS feed

  • Question

  • Im fresh in msbuild stuff and new on this forum so Hello Everyone:)

    When I try to use one of predefined task "ReadlinesfromFile" I get such error:

    "C:\>msbuild d.proj
    Microsoft (R) Build Engine Version 3.5.30729.1
    [Microsoft .NET Framework, Version 2.0.50727.3053]
    Copyright (C) Microsoft Corporation 2007. All rights reserved.

    Build started 2/3/2009 4:51:19 PM.
    Project "C:\d.proj" on node 0 (default targets).
    C:\d.proj(8,9): error MSB4127: The "ReadLinesFromFile" task could not be instantiated from the assembly "Microsoft.Build
    ase verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one
    ing redirect for Microsoft.Build.Framework. Unable to cast object of type 'Microsoft.Build.Tasks.ReadLinesFromFile' to t
    C:\d.proj(8,9): error MSB4060: The "ReadLinesFromFile" task has been declared or used incorrectly, or failed during cons
    Done Building Project "C:\d.proj" (default targets) -- FAILED."

    Here is that trivial d.proj:

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

        <ItemGroup>
            <MyTextFile Include="Items.txt"/>
        </ItemGroup>

        <Target Name="ReadFromFile">
            <ReadLinesFromFile
                File="@(MyTextFile)" >
                <Output
                    TaskParameter="Lines"
                    ItemName="ItemsFromFile"/>
            </ReadLinesFromFile>
        </Target>

    </Project>

    How Can I resolve this problem ?

    Tuesday, February 3, 2009 3:56 PM

Answers

  • Hello,

    Welcome you! :D

    In your case, I think you need to redirect the assembly from Microsoft.Build.Framework 2.0.0.0 to Microsoft.Build.Framework 3.5.0.0.

    About how to do this job and what the reason is, you could check this feedback and this thread.

    Hope can help you, and if the problem still cannot be solved, please feel free to let me know.

    Sincerely!
    Please mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by kelimak Thursday, February 5, 2009 12:24 PM
    Thursday, February 5, 2009 7:12 AM

All replies

  • Hello,

    Welcome you! :D

    In your case, I think you need to redirect the assembly from Microsoft.Build.Framework 2.0.0.0 to Microsoft.Build.Framework 3.5.0.0.

    About how to do this job and what the reason is, you could check this feedback and this thread.

    Hope can help you, and if the problem still cannot be solved, please feel free to let me know.

    Sincerely!
    Please mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by kelimak Thursday, February 5, 2009 12:24 PM
    Thursday, February 5, 2009 7:12 AM
  • I have to modified msbuild.exe.config, now all working good,
    Thank You so much! :)
    Thursday, February 5, 2009 12:25 PM