How to: Debug or Test a LightSwitch Extension
In order to debug a LightSwitch extension, you must install it in a separate instance of Visual Studio. The Visual Studio 2013 SDK provides an experimental instance of Visual Studio for debugging extensions. You must first enable the experimental instance in order to debug.
You can also test an extension—rather than debug it—by installing it in an instance of LightSwitch. If you make subsequent changes to the extension, you must uninstall and then reinstall the extension in order to test the changes.
To enable an experimental instance
In Solution Explorer, choose the BusinessTypeExtension.Vsix project.
On the menu bar, choose Project, BusinessTypeExtension.Vsix Properties.
On the Debug tab, under Start Action, choose Start external program.
Enter the path of the Visual Studio executable, devenv.exe.
By default on a 32-bit system, the path is C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe; on a 64-bit system, it is C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe.
In the Command line arguments field, enter /rootsuffix Exp.
Note
All subsequent LightSwitch extensibility projects will also use this setting, by default.
To debug an extension
On the menu bar in Visual Studio, choose Debug, Start Debugging. An experimental instance of Visual Studio opens.
In the New Project dialog box, expand the Visual Basic or Visual C# node, choose the LightSwitch node, and then choose the LightSwitch Desktop Application template.
In the Name field, enter a name for the test project, and then choose the OK button to create a test project.
Note
You can also open an existing LightSwitch application.
On the menu bar, choose Project, ProjectName Properties.
In the Project Designer, on the Extensions tab, select the check box next to your extension to enable it for the current project.
Add data and screens as you deem necessary to test the functionality of your extension. You can set breakpoints in the main instance of Visual Studio to debug the extension when the test application is in either design or run mode.
Tip
When debugging control extensions that expose properties, you should test the properties in both the design-time and run-time screen designers.
To test an extension without debugging
On the menu bar, choose Build, Build Solution.
Open the output directory of the .Vsix project, and locate the ProjectName.vsix file. The path resembles \ProjectName\ProjectName.Vsix\bin\Debug, under the folder that contains your solution.
Copy the ProjectName.vsix file to a computer where LightSwitch is installed.
Note
This can be the same computer where you are developing the extension.
On the target computer, double-click the ProjectName.vsix file, and in the Visual Studio Extension Installer dialog box, click Install.
Open a new instance of LightSwitch, and then on the menu bar, choose Add, New Project.
In the New Project dialog box, expand the Visual Basic or Visual C# node, choose the LightSwitch node, and then choose the LightSwitch Desktop Application template.
In the Name field, enter a name for the test project, and then choose the OK button to create a test project.
Note
You can also open an existing LightSwitch application.
On the menu bar, choose Project, ProjectName Properties.
In the Project Designer, on the Extensions tab, select the check box next to your extension to enable it for the current project.
Important
If you make subsequent changes to the extension, you must uninstall it in Extension Manager and then reinstall the new version of the extension.
Add data and screens as you deem necessary to test the functionality of your extension.
Tip
When testing control extensions that expose properties, you should test the properties in both the design-time and run-time screen designers.
See Also
Tasks
How to: Create a LightSwitch Extension Project
How to: Set VSIX Package Properties