title: The ResolveComReference task could not be instantiated from Microsoft.Build.Tasks.Core
body: <p>I'm using MsBuild 15.0 APIs to build our own projects.
  Because of this version of MsBuild doesn't exist in GAC, I had to use library which is called MSBuildLocator to load assemblies of MsBuild.
  When I want to build projects with COMReferences I get below error:</p>
  
  <blockquote>
    <p>The "ResolveComReference" task could not be instantiated from
    "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a". Could not load file or assembly
    'Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
    located assembly's manifest definition does not match the assembly
    reference. (Exception from HRESULT: 0x80131040) The
    "ResolveComReference" task has been declared or used incorrectly, or
    failed during construction. Check the spelling of the task name and
    the assembly name.</p>
  </blockquote>
  
  <p>and this is my assembly binding logs</p>
  
  <p>Microsoft.Build.dll</p>
  
  <blockquote>
    <p>LOG: This bind starts in default load context. LOG: Using application
    configuration file:
    C:\Users\tfsbuild\Desktop\MSBuildTester\MSBuildTester\bin\Debug\MSBuildTester.exe.Config
    LOG: Using host configuration file:  LOG: Using machine configuration
    file from
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Redirect found in application configuration file: 4.0.0.0
    redirected to 15.1.0.0. LOG: Post-policy reference: Microsoft.Build,
    Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.DLL.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build/Microsoft.Build.DLL.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.EXE.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build/Microsoft.Build.EXE.
    LOG: All probing URLs attempted and failed.</p>
  </blockquote>
  
  <p>Microsoft.Build.Tasks.Core.dll</p>
  
  <blockquote>
    <p>LOG: This bind starts in LoadFrom load context. WRN: Native image will
    not be probed in LoadFrom context. Native image will only be probed in
    default load context, like with Assembly.Load(). LOG: Using
    application configuration file:
    C:\Users\tfsbuild\Desktop\MSBuildTester\MSBuildTester\bin\Debug\MSBuildTester.exe.Config
    LOG: Using host configuration file:  LOG: Using machine configuration
    file from
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Redirect found in application configuration file: 15.1.0.0
    redirected to 15.1.0.0. LOG: Post-policy reference:
    Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a LOG: GAC Lookup was unsuccessful. LOG:
    Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.Tasks.Core.DLL.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.Tasks.Core/Microsoft.Build.Tasks.Core.DLL.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.Tasks.Core.EXE.
    LOG: Attempting download of new URL
    file:///C:/Users/tfsbuild/Desktop/MSBuildTester/MSBuildTester/bin/Debug/Microsoft.Build.Tasks.Core/Microsoft.Build.Tasks.Core.EXE.
    LOG: Attempting download of new URL file:///C:/Program Files
    (x86)/Microsoft Visual
    Studio/2017/Enterprise/MSBuild/15.0/Bin/Microsoft.Build.Tasks.Core.DLL.
    LOG: Assembly download was successful. Attempting setup of file:
    C:\Program Files (x86)\Microsoft Visual
    Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll
    LOG: Entering run-from-source setup phase. LOG: Assembly Name is:
    Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral,
    PublicKeyToken=b03f5f7f11d50a3a LOG: Where-ref bind Codebase does not
    match what is found in default context. Keep the result in LoadFrom
    context. LOG: Binding succeeds. Returns assembly from C:\Program Files
    (x86)\Microsoft Visual
    Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll.
    LOG: Assembly is loaded in LoadFrom load context.</p>
  </blockquote>
  
  <p>How can I resolve that ?!!</p>