Running C# NUnit based Selenium WebDriver tests in Visual Studio Code in Mac OS (OSX). Command” “shift” “X” open the extension search in visual studio code and search for C# extensions. Download the C/C++ extension for Visual Studio Code, try it out and let us know what you think. File issues and suggestions on GitHub. If you haven’t already provided us feedback, please take this quick survey to help shape this extension for your needs.
-->C C++ Extension For Visual Studio
This topic guides you through building a simple extension package. The extension package will create a new Command in Visual Studio for Mac's Edit menu that allows the user to insert the current date and time into an open text document.
Microsoft Visual Studio For Mac
This example uses the Add-in Maker. The Add-In Maker creates a new Project template and populates it with the required files for our custom extension package.
Begin by launching Visual Studio for Mac if it's not already open:
Install the Add-in Maker extension package using the Extension Manager. From the Visual Studio menu, choose Extensions...:
Navigate to the Gallery tab and type
Addin Maker
into the top-right search bar. Select Addin Maker from the Add-in Development category and click Install. If nothing shows up, hit Refresh and search again:Now that the Addin Maker is installed, you can start building an extension package. Start by creating a new solution.
From the New Solution dialog, choose Other > Miscellaneous > General > Xamarin Studio Addin > C# template and on the following screen name the new Solution
DateInserter
:Visual Studio for Mac will populate a new Solution:
Remove the template code in
Manifest.addin.xml
and replace it with the following:Now you need to set up the files that will eventually handle inserting the date and time into the text editor. Right-Click on the project node and add a new file. Select General > Empty Class and name the new file InsertDateHandler:
Let's remove the template code from
InsertDateHandler.cs
and replace it with the following code:We'll expand these two placeholder methods later.
Right-click on the DateInserter Project and select Add > New File. Select General > Empty Enumeration, and then name the new file DateInserterCommands:
Add the
InsertDate
Command as a new enumeration in theDateInserterCommands.cs
file:At this point, you should have a working extension package. You can test it out by saving your work and running the application. The IDE will launch a new instance of Visual Studio for Mac with the new extension package installed. If you navigate to the Edit menu, you'll see that Visual Studio for Mac has a new option called Insert Date, as illustrated by the screenshot below:
Note that selecting Insert Date from the menu has no effect as the current implementation only has placeholder methods.
The framework is in place for the extension package, and it's time to write the code that powers inserting the date. First, make sure that the Insert Date Command is only enabled when the user has a text file open by replacing the
Update
method inInsertDateHandler.cs
with the following code:Update the Command's
Run
method to insert the date and time with the following code:Finally, let's run our extension package to test it. In the new instance of Visual Studio for Mac, select Edit > Insert Date. The current date and time is inserted at our caret, as illustrated by the screenshot below: