PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Support for Visual Studio 2010
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1833
Page 1 of 1

Author:  Mia [ Wed Nov 02, 2011 5:22 pm ]
Post subject:  Support for Visual Studio 2010

I noticed that the latest version was last updated in 2009. Will there be another update anytime soon? Specifically, all the solution files in PDFSharp-MigraDocFoundation-1_31.zip are for VS 2008 and 2005. I use VS 2010, but when I convert the projects (BuildAll-PdfSharp.sln and BuildAll-MigraDoc-WPF.sln and BuildAll-MigraDoc-VS2008.sln), they no longer compile. There's a long list of errors, and if needed, I can post them.

Replies are appreciated. :)

Author:  Thomas Hoevel [ Thu Nov 03, 2011 8:09 am ]
Post subject:  Re: Support for Visual Studio 2010

There will be an update (but I don't know when). It will include project files for VS 2010.

We use PDFsharp/MigraDoc with VS 2010 and I don't recall real problems during the conversion.

When I have to deal with compilation errors, I always look at the Output window of VS and address the first error that shows up. If you need help, feel free to post the contents of the Output window here (after Rebuild All).

Author:  bradley.ward [ Thu Nov 17, 2011 2:52 pm ]
Post subject:  Re: Support for Visual Studio 2010

Hi Mia,

I am brand new to pdfsharp and I use VS2010. I have not built MigraDoc, but I have successfully built pdfsharp, so perhaps my comments will help.

Here is what I did to successfully get it running:

(Note: I am using PDFSharp version 1.31)

1. Opened the BuildAll-PdfSharp.sln file with VS2010.
2. Of course the VS2010 upgrade wizard started up. I let it do the conversion and got no errors.
3. But things did not build. I did what Thomas suggested, which was to examine the first errors in the VS2010 output window. I then googled that error message, and quickly found the fix. More on that below.

I also changed the .Net Framework to 4.0 with no problem.

Now as to the file I changed. I think that the only issue I had to fix was in the PDFsharp\code\PdfSharp\PdfSharp.Drawing\XFontFamily.cs file.

The compilation occurred on this line (line 266):

Code:
System.Drawing.FontFamily[] families = null;


I found the answer at this URL: viewtopic.php?f=2&t=903&p=2332&hilit=GetFamilies#p233

Specifically, in the post by user "MarcelW" which was posted at Thu Mar 31, 2011 4:53 pm (not sure of TZ; my TZ is EST)

So I changed that one line above to the following:

Code:
// VS2010 compilation warning.
// Fixed based on info on http://forum.pdfsharp.net/viewtopic.php?f=2&t=903&p=2332&hilit=GetFamilies#p2332
// BWW 11/14/2011
#pragma warning disable 618
            families = System.Drawing.FontFamily.GetFamilies(graphics.gfx);
#pragma warning restore 618


Hope this helps!

Now, I'm off to try to find info on how the whole coordinate system thing works in PDFSharp!

Author:  BoonDock [ Mon Dec 05, 2011 1:39 pm ]
Post subject:  Re: Support for Visual Studio 2010

That's a nice elegant "non" fix.
I didn't find that till I had done some hacking of my own.
This seems to work...
replace the line
Code:
families = System.Drawing.FontFamily.getFamilies(graphics.gfx);

with the line
Code:
families = System.Drawing.FontFamily.Families;

and the project compiles.

I cannot guarantee that it's the correct fix, but it is A fix..
All the best
John

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/