none
Debugging .NET Smart Device project under Win32 RRS feed

  • Question

  • Hi all,

    I hope that this is the right forum to ask this question.

    We have a .NET smart device project that we'd like to debug under Win32 - that is, directly on the PC without passing by the emulator.  The emulator on our PC is *hideously* slow and since the project doesn't contain any hardware specific functionality we'll gain a lot of time of we can simply run the project under Windows.

    If I double click on the .exe the project executes perfectly in the Windows environment, however I can't find any way to execute the program in debug via Visual Studio.  Since it's a smart device VS insists that I pass via a device. 

    Is there a solution to this problem.  For example, is there a "device emulator" that simply launches the app on Windows rather than passing via the emulator?

    Thanks for any help you can offer me.

    Tim

    Friday, November 28, 2008 10:05 AM

Answers

  • Hi Tim

    Yes there is.
    In your Workspace, create an additional .NET (Desktop) Console Application project.
    In this project, add a reference your smart device project -> Visual Studio will bring up a warning - click 'yes' to add the reference.

    In the Main function of the newly created Consol Application, simply call the Smart Device App's entry point.
    To get this working, you have to make the Smart Device app's Main method public (See Sampe 2)

    Set the Console Application as your startup project.
    To prevent Visual Studio from deploying your smart device app to the device, remove the 'Deploy' Checkmark (in Solution Properties -> Confguration Properties)

    now start debugging as you'd do for a desktop project.

    Be aware that this only works as long as your not using any Windows Mobile specific classes.

    Michael

    Sample 1: The (entire) Destop Console Application
    namespace
    ConsoleApplication
    {
        
    class Program
        {
            
    static void Main (string[] args)
            {
                //launch the Smart Device Application on the destop
                
    SmartDeviceProject.Program.Main ();
            }
        }
    }

    Sample 2: the modified Smart Device Program class (the bold items)
    namespace
    SmartDeviceProject
    {
        public static class
    Program
        
    {
            
    ///
    <summary>
            
    ///
    The main entry point for the application.
            
    ///
    </summary>
            
    [MTAThread
    ]
            public static void
    Main ()
            {
                Application.Run (new Form1
    ());
            }    
        }
    }


    MVP Windows Embedded
    Friday, November 28, 2008 6:52 PM
    Moderator

All replies

  • Hi Tim

    Yes there is.
    In your Workspace, create an additional .NET (Desktop) Console Application project.
    In this project, add a reference your smart device project -> Visual Studio will bring up a warning - click 'yes' to add the reference.

    In the Main function of the newly created Consol Application, simply call the Smart Device App's entry point.
    To get this working, you have to make the Smart Device app's Main method public (See Sampe 2)

    Set the Console Application as your startup project.
    To prevent Visual Studio from deploying your smart device app to the device, remove the 'Deploy' Checkmark (in Solution Properties -> Confguration Properties)

    now start debugging as you'd do for a desktop project.

    Be aware that this only works as long as your not using any Windows Mobile specific classes.

    Michael

    Sample 1: The (entire) Destop Console Application
    namespace
    ConsoleApplication
    {
        
    class Program
        {
            
    static void Main (string[] args)
            {
                //launch the Smart Device Application on the destop
                
    SmartDeviceProject.Program.Main ();
            }
        }
    }

    Sample 2: the modified Smart Device Program class (the bold items)
    namespace
    SmartDeviceProject
    {
        public static class
    Program
        
    {
            
    ///
    <summary>
            
    ///
    The main entry point for the application.
            
    ///
    </summary>
            
    [MTAThread
    ]
            public static void
    Main ()
            {
                Application.Run (new Form1
    ());
            }    
        }
    }


    MVP Windows Embedded
    Friday, November 28, 2008 6:52 PM
    Moderator
  • Hi Michael,

    That's worked perfectly.  Thanks for you help.

    Regards,

    Tim
    Monday, December 1, 2008 8:07 AM