PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
unable to build 1.30 due to GetFamilies deprecation https://forum.pdfsharp.net/viewtopic.php?f=2&t=903 |
Page 1 of 1 |
Author: | dennis33 [ Fri Oct 09, 2009 6:15 pm ] |
Post subject: | unable to build 1.30 due to GetFamilies deprecation |
Using PDFSharp 1.30 but unable to compile the BuildAll-PdfSharp project due to an error in the deprecation of the System.Drawing.FontFamily.GetFamilies(graphics.gfx) function. Error 1 Warning as Error: 'System.Drawing.FontFamily.GetFamilies(System.Drawing.Graphics)' is obsolete: 'Do not use method GetFamilies, use property Families instead' F:\Dev\PDFsharp\code\PdfSharp\PdfSharp.Drawing\XFontFamily.cs 268 18 PdfSharp The MS advised workaround appears to be to use the System.Drawing.FontFamily.Families, but that assumes the current context, does not use the specified context, which might be a concern. Here is the change I needed to make (VS 2008 SP1, Windows 7) to get a good compile Line 268 of XFontFamily.xs commented out //families = System.Drawing.FontFamily.GetFamilies(graphics.gfx); // error families = System.Drawing.FontFamily.Families; // new |
Author: | Thomas Hoevel [ Mon Oct 12, 2009 8:12 am ] |
Post subject: | Re: unable to build 1.30 due to GetFamilies deprecation |
This is only a warning! You can also turn "Treat Warnings as Error" off to compile the original source code. |
Author: | MarcelW [ Thu Mar 31, 2011 9:53 pm ] |
Post subject: | Re: unable to build 1.30 due to GetFamilies deprecation |
You can solve the problem without turning off "Warning as error" this way: Code: #pragma warning disable 618
families = System.Drawing.FontFamily.GetFamilies(graphics.gfx); #pragma warning restore 618 |
Author: | searock [ Sat Jul 23, 2011 3:09 am ] |
Post subject: | Re: unable to build 1.30 due to GetFamilies deprecation |
MarcelW, Thomas Hoevel Thanks a lot for your solution. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |