How to make Preprocessor directives to work in Visual Studio?

I'm trying to use this code:

#if __IOS__
using System.Drawing;
using UIKit;
using CoreGraphics;
#endif

#if __ANDROID__
using Android.Graphics;
#endif

#if WINDOWS_PHONE
using Microsoft.Phone;
using System.Windows.Media.Imaging;
#endif

namespace SterenSchedule.Helpers
{
    public static class ImageResizer
    {
        static ImageResizer()
        {
        }

        public static byte[] ResizeImage(byte[] imageData, float width, float height)
        {
#if __IOS__
            return ResizeImageIOS ( imageData, width, height );
#endif
#if __ANDROID__
            return ResizeImageAndroid ( imageData, width, height );
#endif
#if WINDOWS_PHONE
            return ResizeImageWinPhone ( imageData, width, height );![]()
#endif

But VS isn't recognising my preprocessor directives, In this case it should have the android code enabled, but it isn't.
If i open this project in Xamarin Studio it does respect the preprocessor directives.
In VS I have declared the symbols in each platform properties.

Any idea on what's happening?
thanks in advanced!

Answers

  • AZCoder2AZCoder2 USMember

    I have the have basically the same problem. The preprocessor directives are respected for the most part, though strangely on occasion. It's like they don't matter one way or the other. Frustrating.

Sign In or Register to comment.