Could not find reference "mscorlib".
ccpu opened this issue · 4 comments
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
@cyrus-d - Did you find a solution to this? Running into this same error.
Duplicate of dotnet/msbuild#3726, which has some workarounds.
This issue was moved to dotnet/msbuild#4009
@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.