corert
corert copied to clipboard
EXEC : error : [TEMPORARY EXCEPTION MESSAGE] FileLoadErrorGeneric: System.Windows.Forms
seems like a regression
i am compiling a dotnet core 2.1 console app. why it looks for system windows forms now?
using official build <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" /> <PackageReference Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" /> <PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" />
while an older build has no such error
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27322-02" />
<PackageReference Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27322-02" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27322-02" />
the new build I used that has the issue
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" />
<PackageReference Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" />
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-27414-02" />
any fix?
My only guess would be that after #6820 we're compiling code that we didn't compile before that references Windows.Forms. The compiler or the build targets definitely don't inject references to Windows.Forms.
Try adding <RootAllApplicationAssemblies>false</RootAllApplicationAssemblies>
to one of the PropertyGroups in your CSPROJ to see if it makes the message disappear.
Still happens in 1.0.0-alpha-29228-02 RootAllApplicationAssemblies
didn't help
Compiling as dotnet publish /p:NativeLib=Shared -r win-x64 -c release
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-29228-02" />
</ItemGroup>
<PropertyGroup>
<RootAllApplicationAssemblies>false</RootAllApplicationAssemblies>
</PropertyGroup>
</Project>
Hmm... Interesting, my vs crashed, restarted and finally it started building. I guess new Microsoft.DotNet.ILCompiler package got pulled.
Oh even more interesting, when I have 2 instances of Visual Studio running - one with Unity project, other one with this library then the problem error occurs.