This project has moved and is read-only. For the latest updates, please go here.

compiling sourcecode with VS2010 / C#

Topics: Developer Forum
Oct 8, 2011 at 10:37 AM


I'm trying to compile my project witht the FlickrNet sourcode, rather than the officially released DLL (
There's nothing wrong with the DLL, it's just quicker to get to learn the FlickrNet API when you're able to step through the sourcecode.
Unfortunately, for various reasons I can't get the sourcecode to work with Visual Studio 2010 

Any help is greatly appreciated,

Here's what I did:

Attempt #1

I downloaded sourcecode #92857 and I tried to open the solution file FlickrNetVS10.sln, but this gives me the following error: 
One or more projects in the solution were not loaded correctly. Please see Output window for details.

Output Window:
\flickrnet-92857\FlickrNet\FlickrNetWP7.csproj : error  : The project file '\flickrnet-92857\FlickrNet\FlickrNetWP7.csproj' cannot be opened.
The project type is not supported by this installation.

==> Any idea what's wrong here?

Attempt #2

Still using sourcecode #92857, I tried to open the file FlickrNet\FlickrNet.csproj in stead.
Visual Studio 2010 converted this file and it loaded just fine.
When I compiled it, I got a compiler error on this line:

UploadProgressEventArgs args = new UploadProgressEventArgs(soFar, soFar == dataBuffer.Length);

compiler error:
Flickr_UploadAsync.cs(134,60): error CS1502: The best overloaded method match for 'FlickrNet.UploadProgressEventArgs.UploadProgressEventArgs(long, long)' has some invalid arguments
\Flickr_UploadAsync.cs(134,95): error CS1503: Argument 2: cannot convert from 'bool' to 'long'

I fixed this by changing the line to:

UploadProgressEventArgs args = new UploadProgressEventArgs(soFar, dataBuffer.Length);

After this I was able to compile the (Debug) DLL and add it to my project. This gave me what I wanted (stepping through the FlickrNet sourcecode), but it also introduced a new issue.

While running this piece of code:

            FoundUser user2 = flickr.PeopleFindByUserName("whatever");
                PhotoSearchOptions search2 = new PhotoSearchOptions();
                search2.UserId = user2.UserId;
                search2.TagMode = TagMode.AllTags;
                search2.Tags = "winter,holland";
                search2.SortOrder = PhotoSearchSortOrder.InterestingnessDescending;
                PhotoCollection photos2 = flickr.PhotosSearch(search2);
                foreach (Photo p in photos2)
==>              PhotoInfo pi = flickr.PhotosGetInfo(p.PhotoId);
                    if (pi.Tags.Count > 0)
                        foreach (PhotoInfoTag t in pi.Tags) Debug.Write(t.TagText + " ");

I got the following exception: 

FlickrNet.ParsingException was unhandled
  Message=Unknown element: people
       at FlickrNet.UtilityMethods.CheckParsingException(XmlReader reader) in \flickrnet-92857\FlickrNet\UtilityMethods.cs:line 484
       at FlickrNet.PhotoInfo.LoadElements(XmlReader reader) in \flickrnet-92857\FlickrNet\PhotoInfo.cs:line 418
       at FlickrNet.PhotoInfo.FlickrNet.IFlickrParsable.Load(XmlReader reader) in \flickrnet-92857\FlickrNet\PhotoInfo.cs:line 357
       at FlickrNet.Flickr.GetResponse[T](Dictionary`2 parameters, TimeSpan cacheTimeout) in \flickrnet-92857\FlickrNet\Flickr_GetResponse.cs:line 109
       at FlickrNet.Flickr.GetResponseCache[T](Dictionary`2 parameters) in \flickrnet-92857\FlickrNet\Flickr_GetResponse.cs:line 22
       at FlickrNet.Flickr.PhotosGetInfo(String photoId, String secret) in \flickrnet-92857\FlickrNet\Flickr_Photos.cs:line 339
       at FlickrNet.Flickr.PhotosGetInfo(String photoId) in \flickrnet-92857\FlickrNet\Flickr_Photos.cs:line 323
       at FlickrNetDLLWithSource01.Form1.button1_Click(Object sender, EventArgs e) in \Projects\FlickrNetDLLWithSource01\FlickrNetDLLWithSource01\Form1.cs:line 44
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)

Now this doesn't happen if I run the same code in a project that uses the officially released DLL (

Attempt #3

Then I figured I should use the same version of the sourcecode that was used to produce the officially released DLL (
So I downloaded, converted and compiled the file FlickrNet\FlickrNet.csproj project.
Added this DLL to my project... but still get the same exception.

I'm back to using the officially released DLL ( which works fine, but unfortunately without sourcecode.

Oct 8, 2011 at 5:36 PM

Well I think you've probably hit every problem you're likely to hit there all in one go, so well done :)

Attempt 1#: I only use Visual Studio 2010 for Windows Phone 7 development, so that is the only project that that solution loads, hence why this wouldn't work for you if you don't have the Windows 7 Phone SDK installed.

Attempt 2#: I'm fairly sure this bug has been fixed in the latest source code, but I am currently midway through implementing OAuth, so the code is a little all over the place.

Attempt 3#: This is one of the drawwback of the debug code - the released DLLs are release configuration, and do not throw this exception when Flickr adds new attributes or elements to the response XML. To get this to work you could either add an extra case statement to the switch statement that handles the response from Flickr inside PhotoInfo.Load, or alternatively you could actually specify PhotoSearchOptions.Extra to return the tags in the first method, and not need to call PhotosGetInfo at all.


Oct 9, 2011 at 8:49 AM

cool, thanks for the two work-arounds. I had overlooked the PhotoSearchOptions.Extra so far.... this makes the code a bit simpler & faster as well, which is always nice. 

I hadn't realized that FlickrNet is by definition one step behind when decides to change their response XML format, I thought it was me recompiling with the wrong whatever-setting that caused the exception. So it's good to know how to handle this in future.

thanks again for the help, I can now proceed with the with-Flickrnet-source-code version of my project