jeffkl / RoslynCodeTaskFactory

An MSBuild CodeTaskFactory that uses Roslyn compiler for cross platform compatibility
MIT License
26 stars 3 forks source link

Could not find reference "mscorlib". #39

Closed ccpu closed 5 years ago

ccpu commented 6 years ago

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:

Target: .NET Core v2.1

maybe related problem here: https://github.com/Microsoft/msbuild/issues/3726

Can you please tell what am I missing here.

Thanks

StevenRasmussen commented 5 years ago

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

rainersigwald commented 5 years ago

Duplicate of https://github.com/Microsoft/msbuild/issues/3726, which has some workarounds.

jeffkl commented 5 years ago

This issue was moved to Microsoft/msbuild#4009

ccpu commented 5 years ago

@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.