<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: [DisplayFusion 12.1.1] C# Script Compilation Fails with CS0012 – Missing System.Private.Windows.GdiPlus Reference</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974</link>
<description>DisplayFusion RSS: [DisplayFusion 12.1.1] C# Script Compilation Fails with CS0012 – Missing System.Private.Windows.GdiPlus Reference</description>
<lastBuildDate>Fri, 13 Nov 2026 21:03:23 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974</generator>
<item>
<title>RE: [DisplayFusion 12.1.1] C# Script Compilation Fails with CS0012 – Missing System.Private.Windows.GdiPlus Reference</title>
<link>https://www.displayfusion.com/Discussions/View/displayfusion-1211-c-script-compilation-fails-with-cs0012-missing-systemprivatewindowsgdiplus-reference/?ID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974#2</link>
<pubDate>Fri, 13 Nov 2026 19:37:31 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/displayfusion-1211-c-script-compilation-fails-with-cs0012-missing-systemprivatewindowsgdiplus-reference/?ID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I was able to reproduce this here, so we've added it to our list to look into.
Thanks!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I was able to reproduce this here, so we've added it to our list to look into.<br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
<item>
<title>[DisplayFusion 12.1.1] C# Script Compilation Fails with CS0012 – Missing System.Private.Windows.GdiPlus Reference</title>
<link>https://www.displayfusion.com/Discussions/View/displayfusion-1211-c-script-compilation-fails-with-cs0012-missing-systemprivatewindowsgdiplus-reference/?ID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974</link>
<pubDate>Fri, 13 Nov 2026 11:20:30 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/displayfusion-1211-c-script-compilation-fails-with-cs0012-missing-systemprivatewindowsgdiplus-reference/?ID=01a1d4a3-3c53-75d5-8fe7-f99b000d2974</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hi,
I'm experiencing a C# scripted function compilation issue in DisplayFusion 12.1.1, related to System.Drawing.Graphics, TextRenderer, and a missing System.Private.Windows.GdiPlus assembly reference.
The same code worked in DisplayFusion 12.0.2 but fails to compile in 12.1.1 after the migrati...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hi,<br/>
<br/>
I'm experiencing a C# scripted function compilation issue in DisplayFusion 12.1.1, related to System.Drawing.Graphics, TextRenderer, and a missing System.Private.Windows.GdiPlus assembly reference.<br/>
<br/>
The same code worked in DisplayFusion 12.0.2 but fails to compile in 12.1.1 after the migration to .NET 10.<br/>
<br/>
Minimal Reproduction:<br/>
<br/>
Create a new C# scripted function and paste the following code:<br/>
<br/>
<div class="col-md-12 BoxWrap"><div class="Box table-responsive"><a name="code" style="width:0; height:0;"></a><h2 class="TableTitle" style="border:0"><div class="TableTitleText">Code</div><div class="TitleButtons"><div class="TableTitleButton"><a href="#" onclick="return false;" data-clipboard-target="#code01a1d6b8e3ef713eb164d6e7842581ab" class="ClipboardCopyControl"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/clone.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Copy</span></a></div><div class="TableTitleButton"><a href="#" onclick="bfs.util.codeEditorSelectAll('code01a1d6b8e3ef713eb164d6e7842581abJs'); return false;"><img src="https://www.displayfusion.com/MediaCommon/SVGs/FontAwesome/square-check.blue.svg" style="box-sizing:border-box;position:relative;overflow:hidden;width:auto;max-width:16px;height:16px;" /><span class="Text">Select All</span></a></div></div></h2><div class="TableTitleContent table-responsive"><div class="AceEditorWrapper" style="border-top:solid 1px var(--color-default-border);padding:0"><pre id="code01a1d6b8e3ef713eb164d6e7842581abJs" name="code01a1d6b8e3ef713eb164d6e7842581abJs" spellcheck="true" class="skiptranslate" style="width:100%;min-height:75px">using System;&#xA;using System.Drawing;&#xA;using System.Windows.Forms;&#xA;&#xA;public static class DisplayFusionFunction&#xA;{&#xA;    public static void Run(IntPtr windowHandle)&#xA;    {&#xA;    }&#xA;&#xA;    private static void Test(PaintEventArgs e)&#xA;    {&#xA;        TextRenderer.DrawText(&#xA;            e.Graphics,&#xA;            &quot;Test&quot;,&#xA;            SystemFonts.DefaultFont,&#xA;            new Point(10, 10),&#xA;            Color.Black);&#xA;&#xA;        TextRenderer.MeasureText(&#xA;            e.Graphics,&#xA;            &quot;Test&quot;,&#xA;            SystemFonts.DefaultFont,&#xA;            new Size(200, 50));&#xA;    }&#xA;}</pre><textarea id="code01a1d6b8e3ef713eb164d6e7842581ab" name="code01a1d6b8e3ef713eb164d6e7842581ab" style="position:absolute;top:0;left:-999999px;width:1px;height:1px"></textarea></div>
</div></div></div><br/>
<br/>
Even though Test() is never called, compilation fails.<br/>
The compiler reports:<br/>
<br/>
<div class="Inline"><pre>The type 'IGraphics' is defined in an assembly that is not referenced.
You must add a reference to assembly
'System.Private.Windows.GdiPlus, Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'.</pre></div><br/>
<br/>
The same error occurs for `IGraphicsContextInfo`.<br/>
<br/>
On one computer, manually adding `System.Private.Windows.GdiPlus.dll` through the DisplayFusion References dialog fails with:<br/>
<br/>
<div class="Inline"><pre>The following reference(s) failed to be added successfully.
Please make sure that they are compatible with .NET 10
or .NET Standard 2.x.

- System.Private.CoreLib.dll

Could not load file or assembly
'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.2\System.Private.CoreLib.dll'.

The system cannot find the file specified.

Exception.HResult: COR_E_FILENOTFOUND (0x80070002)
FileNotFoundException.FileName:
C:\Program Files\dotnet\shared\Microsoft.NETCore.App\10.0.2\System.Private.CoreLib.dll</pre></div><br/>
<br/>
However, the file does exist (Test-Path returns True).<br/>
<br/>
On another computer, adding the assembly does not produce this reference-loading error, but the script still fails to compile with the original IGraphics / IGraphicsContextInfo errors.<br/>
<br/>
Tested Environments:<br/>
<br/>
Computer 1:<br/>
- DisplayFusion 12.1.1<br/>
- .NET Runtime 10.0.2<br/>
- .NET SDK 10.0.102<br/>
- Windows Desktop Runtime 10.0.2<br/>
- The .NET 10 reference assembly exists at `C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\10.0.2\ref\net10.0\System.Private.Windows.GdiPlus.dll`<br/>
<br/>
Computer 2:<br/>
- DisplayFusion 12.1.1<br/>
- .NET Runtime 10.0.14<br/>
- No .NET SDK installed<br/>
- Manually adding the assembly succeeds, but compilation still fails<br/>
<br/>
Working Workaround<br/>
<br/>
The following code compiles successfully:<br/>
<br/>
<div class="Inline"><pre>IDeviceContext dc = (IDeviceContext)(object)e.Graphics;

TextRenderer.DrawText(
    dc,
    "Test",
    SystemFonts.DefaultFont,
    new Point(10, 10),
    Color.Black);</pre></div><br/>
<br/>
However, a direct assignment fails:<br/>
<br/>
<div class="Inline"><pre>IDeviceContext dc = e.Graphics;</pre></div><br/>
<br/>
This strongly suggests a compile-time assembly reference resolution issue rather than a runtime issue.<br/>
<br/>
The workaround is functional, but I would prefer not to rely on an unnecessary cast through `object` just to compile a standard WinForms API call.<br/>
<br/>
Expected Behavior<br/>
<br/>
DisplayFusion should compile standard WinForms code using `Graphics` and `TextRenderer` without requiring manual references or workarounds, regardless of whether a standalone .NET SDK is installed.<br/>
<br/>
Questions<br/>
<br/>
1. Is this a known issue with the DisplayFusion 12.1.x scripted function compiler?<br/>
2. Does DisplayFusion automatically include `System.Private.Windows.GdiPlus.dll` in its compilation references?<br/>
3. Is there a fix planned or already available in a beta release?<br/>
<br/>
This appears similar to a .NET 10 reference resolution issue reported to Microsoft and fixed in .NET SDK 10.0.101:<br/>
<br/>
https://github.com/dotnet/sdk/issues<br/>
<br/>
Thanks!
</div>
]]></content:encoded>
</item>
</channel>
</rss>