Skip to content

build-test.sh failing (MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded... Assembly with same name is already loaded) #12834

Closed
dotnet/coreclr
#25101

Description

@sdmaclea

I updated to tip last night.

Ubuntu 16.04 (previously working)

./build.sh
./build-test.sh

failed.

git clean -xdf
./build.sh
./build-test.sh

failed.
435 errors building managed assemblies.

./build-test.sh generatelayoutonly

succeeded (I didn't need the managed test assemblies....

Activity

  1. AndyAyersMS commented on Jun 7, 2019

    @AndyAyersMS
    Member

    Did your failures look like this, by any chance? If so I am seeing this too.

    /home/andy/repos/coreclr/.packages/microsoft.net.compilers.toolset/3.2.0-beta2-19272-03/tasks/netcoreapp2.1/Microsoft.CSharp.Core.targets(59,5): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly /home/andy/repos/coreclr/.packages/microsoft.net.compilers.toolset/3.2.0-beta2-19272-03/build/../tasks/netcoreapp2.1/Microsoft.Build.Tasks.CodeAnalysis.dll. Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [/home/andy/repos/coreclr/tests/src/CoreMangLib/system/delegate/VSD/OpenDelegate.csproj]
    
  2. elinor-fung commented on Jun 7, 2019

    @elinor-fung
    Member

    @sdmaclea do you happen to know what your were synced to before updating to tip?

  3. sdmaclea commented on Jun 7, 2019

    @sdmaclea
    ContributorAuthor

    This is the error I am seeing

    /home/stmaclea/git/coreclr/.packages/microsoft.net.compilers.toolset/3.2.0-beta2-19272-03/tasks/netcoreapp2.1/Microsoft.CSharp.Core.targets(59,5): error MSB4062: 
    The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly 
    /home/stmaclea/git/coreclr/.packages/microsoft.net.compilers.toolset/3.2.0-beta2-19272-03/build/../tasks/netcoreapp2.1/Microsoft.Build.Tasks.CodeAnalysis.dll. 
    Assembly with same name is already loaded Confirm that the <UsingTask> declaration is 
    correct, that the assembly and all its dependencies are available, and that the task contains 
    a public class that implements Microsoft.Build.Framework.ITask. [/home/stmaclea/git/coreclr/tests/src/JIT/Methodical/Arrays/lcs/_dbglcsmixed.csproj]
    

    It seems to match @AndyAyersMS error.

    When trying to reproduce, it worked w/o error when running ./build-test.sh, but reappeared after cleaning.

    So perhaps (strangely) this works

    git clean -xdf
    ./build.sh
    ./build-test.sh
    # ignore errors
    ./build-test.sh generatelayoutonly
    ./build-test.sh
    

    For reference b519939 0c5be46 is what I downloaded last night.
    I do not have a reference for the last working version. I updated from 96e8c58

  4. adamsitnik commented on Jun 8, 2019

    @adamsitnik
    Member

    Same here, I tried to run in on ARM64 and got following error:

    robox@ubunddarm64s-016:/home/adsitnik/coreclr$ ./build-test.sh release
    __DistroRid: linux-arm64
    __RuntimeId: linux-arm64
    Using RID linux-arm64 for BuildTools native tools
    Skipped installing build tools.
    Building Tests...
    __BuildOS: Linux
    __BuildArch: arm64
    __BuildType: Release
    __TestIntermediatesDir: /home/adsitnik/coreclr/bin/tests/obj/Linux.arm64.Release
    __NativeTestIntermediatesDir: /home/adsitnik/coreclr/bin/tests/obj/Linux.arm64.Release/Native
    __ManagedTestIntermediatesDir: /home/adsitnik/coreclr/bin/tests/obj/Linux.arm64.Release/Managed
    Creating TestBinDir: /home/adsitnik/coreclr/bin/tests/Linux.arm64.Release
    Creating LogsDir: /home/adsitnik/coreclr/bin/Logs
    Creating MsbuildDebugLogsDir: /home/adsitnik/coreclr/bin/Logs/MsbuildDebugLogs
    Building step 'Restore product binaries (build tests)' via "/home/adsitnik/coreclr/dotnet.sh" msbuild /nologo /verbosity:minimal /clp:Summary /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true /p:UsePartialNGENOptimization=false /maxcpucount /home/adsitnik/coreclr/tests/build.proj "/flp:Verbosity=normal;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.log" "/flp1:WarningsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.wrn" "/flp2:ErrorsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.err" /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log /t:BatchRestorePackages /p:__BuildArch=arm64 /p:__BuildType=Release /p:__BuildOS=Linux
    Running init-dotnet.sh
    Installing dotnet using Arcade...
    Running: /home/adsitnik/coreclr/.dotnet/dotnet msbuild /nologo /verbosity:minimal /clp:Summary /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true /p:UsePartialNGENOptimization=false /maxcpucount /home/adsitnik/coreclr/tests/build.proj /flp:Verbosity=normal;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.log /flp1:WarningsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.wrn /flp2:ErrorsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.err /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log /t:BatchRestorePackages /p:__BuildArch=arm64 /p:__BuildType=Release /p:__BuildOS=Linux
    MSBUILD : error MSB1021: Cannot create an instance of the logger. The given assembly name or codebase was invalid. (0x80131047)
    Switch: BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log
    ERROR: An error occurred in /home/adsitnik/coreclr/.dotnet/dotnet msbuild /nologo /verbosity:minimal /clp:Summary /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true /p:UsePartialNGENOptimization=false /maxcpucount /home/adsitnik/coreclr/tests/build.proj /flp:Verbosity=normal;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.log /flp1:WarningsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.wrn /flp2:ErrorsOnly;LogFile=/home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.err /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log /t:BatchRestorePackages /p:__BuildArch=arm64 /p:__BuildType=Release /p:__BuildOS=Linux. Check logs under /home/adsitnik/coreclr.
    Failed to build Restore product binaries (build tests). See the build logs:
        /home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.log
        /home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.wrn
        /home/adsitnik/coreclr/bin/Logs/Restore_Product.Linux.arm64.Release.err
    

    The folder with logs is empty because the code fails when it tries to create the logger.

  5. elinor-fung commented on Jun 11, 2019

    @elinor-fung
    Member

    @sdmaclea @AndyAyersMS could you see if the same errors still occur if you build the product with /nodeReuse:false:

    ./build.sh /nodeReuse:false
    ./build-test.sh
    

    @adamsitnik that looks to be a different issue.

  6. changed the title [-]build-test.sh failing [/-] [+]build-test.sh failing (MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded... Assembly with same name is already loaded)[/+] on Jun 11, 2019
  7. adamsitnik commented on Jun 11, 2019

    @adamsitnik
    Member
  8. jashook commented on Jun 11, 2019

    @jashook
    Contributor

    @elinor-fung from two runs /nodeReuse:false seems to fix the issue.

    build-test.sh <-- failures
    build-test.sh /nodeReuse:false <-- clean build.

    Building more to verify.

  9. jashook commented on Jun 11, 2019

    @jashook
    Contributor

    Seems like a few more builds confirm nodeReuse fixes the problem.

  10. jashook commented on Jun 11, 2019

    @jashook
    Contributor

    Putting out a pr.

  11. elinor-fung commented on Jun 11, 2019

    @elinor-fung
    Member

    @jashook could you make sure you also build the product first (with /nodeReuse:false)?

    I think this started happening after we took an update from arcade (0b520b3) which included updating to a newer compiler toolset (11fa382) such that it is no longer the same version as that used by BuildTools. My guess is that since the scripts don't specify /nodeReuse:false (for Unix - Windows scripts do), the nodes that already have a different version loaded get reused, resulting in the failure.

  12. jashook commented on Jun 11, 2019

    @jashook
    Contributor

    Change will include nodeReuse:false in both build.sh and build-test.sh by default to match windows scripts.

  13. AndyAyersMS commented on Jun 11, 2019

    @AndyAyersMS
    Member

    @elinor-fung finally got around to retrying, and it looks like /node-reuse:false works for me....

  14. transferred this issue fromdotnet/coreclron Jan 31, 2020
  15. added this to the 3.0 milestone on Jan 31, 2020
  16. ghost locked as resolved and limited conversation to collaborators on Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-coreclr

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions