Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.

Could not find reference "mscorlib". #39

Closed
ccpu opened this issue Nov 2, 2018 · 4 comments
Closed

Could not find reference "mscorlib". #39

ccpu opened this issue Nov 2, 2018 · 4 comments

Comments

@ccpu
Copy link

ccpu commented Nov 2, 2018

Hi,

I am using 'RoslynCodeTaskFactory' for my task as suggested in here:

MSBuild inline tasks with RoslynCodeTaskFactory

Task Code:

<UsingTask TaskName="ExecAsync" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
    <ParameterGroup>
      <Command ParameterType="System.String" Required="true" />
    </ParameterGroup>
    <Task>
      <Code Type="Fragment" Language="cs">
        <![CDATA[
            var procStartInfo =
                new System.Diagnostics.ProcessStartInfo("cmd", "/c" + Command)
                {
                    RedirectStandardOutput = false,
                    UseShellExecute = true,
                    CreateNoWindow = false,
                    WindowStyle=System.Diagnostics.ProcessWindowStyle.Minimized
                };

            System.Diagnostics.Process proc = new System.Diagnostics.Process
            {
                StartInfo = procStartInfo
            };
            proc.Start();
       ]]>
      </Code>
    </Task>
  </UsingTask>

it does work fine in the visual studio, however, when running 'dotnet build' it will throw the following errors:

  • error MSB3755: Could not find reference "mscorlib". If this reference is required by your code, you may get compilation errors.

  • error MSB3755: Could not find reference "netstandard". If this reference is required by your code, you may get compilation errors.

  • error MSB4175: The task factory "RoslynCodeTaskFactory" could not be loaded from the assembly "C:\Program Files\dotnet\sdk\2.2.100-preview3-009430\Microsoft.Build.Tasks.Core.dll". The task factory must return a value for the "TaskType" property.

Target: .NET Core v2.1

maybe related problem here:
dotnet/msbuild#3726

Can you please tell what am I missing here.

Thanks

@StevenRasmussen
Copy link

@cyrus-d - Did you find a solution to this? Running into this same error.

@rainersigwald
Copy link

rainersigwald commented Dec 13, 2018

Duplicate of dotnet/msbuild#3726, which has some workarounds.

@jeffkl
Copy link
Owner

jeffkl commented Dec 13, 2018

This issue was moved to dotnet/msbuild#4009

@jeffkl jeffkl closed this as completed Dec 13, 2018
@ccpu
Copy link
Author

ccpu commented Dec 13, 2018

@SimplerSoftware Unfortunately I couldn't find a proper solution for this, it works fine with visual studio and I am mostly using VS for my works, so it's not bothering me that much. sorry, couldn't be of much help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants