Visual Studio for Mac provides a full-featured Integrated Development Environment (IDE) for developing .NET Core applications. This article walks you through building a .NET Core solution that includes a reusable library and unit testing.
I have a site that was built using database first and I'm trying to continue development of it on a mac. Normally I would run the Scaffold-dbContext using the Console Package Manager in Visual Studio. The mac version doesn't have this I tried running it in Terminal, but that obviously didn't work. Steps to Reproduce open this rar open Basic/WG3000DemoBasic/WG3000DemoBasic.csproj release - run This is a 3rd party project. I tested it 6weeks ago on Sierra.
This tutorial shows you how to create an application that accepts a search word and a string of text from the user, counts the number of times the search word appears in the string using a method in a class library, and returns the result to the user. The solution also includes unit testing for the class library as an introduction to unit testing concepts. If you prefer to proceed through the tutorial with a complete sample, download the sample solution. For download instructions, see Samples and Tutorials.
Note
Your feedback is highly valued. There are two ways you can provide feedback to the development team on Visual Studio for Mac:
For more information on prerequisites, see the .NET Core dependencies and requirements. For the full system requirements of Visual Studio 2019 for Mac, see Visual Studio 2019 for Mac Product Family System Requirements.
Neoragex emulator. The Neo Geo emulator is also compatible on Mac and windows 7. Part 3.10 Popular Neo Geo Emulators This section consists of a list of emulators with their ranking from highest to lowest which allows you to play NeoGeo games on a variety of platforms including PC & mac and even consoles such as Dreamcast & Xbox. Start playing the game by installing many more games. How to install Neo Geo Games. First you download the game. Then you need to extract the game’s file, WinRar software. After extracting the game, double click on the file named NeoRAGEx 5.0.exe.
On the start window, select New Project. In the New Project dialog under the .NET Core node, select the .NET Standard Library template. This command creates a .NET Standard library that targets .NET Core as well as any other .NET implementation that supports version 2.1 of the .NET Standard. If you have multiple versions of the .NET Core SDK installed, you can choose different versions of .NET Standard for your library. Choose '.NET Standard 2.1' and select Next.
Name the project 'TextUtils' (a short name for 'Text Utilities') and the solution 'WordCounter'. Leave Create a project directory within the solution directory checked. Select Create.
In the Solution pad, expand the TextUtils
node to reveal the class file provided by the template, Class1.cs. Ctrl-click the file, select Rename from the context menu, and rename the file to WordCount.cs. Open the file and replace the contents with the following code:
Save the file by using any of three different methods: use the keyboard shortcut ⌘+s, select File > Save from the menu, or ctrl-click on the file's tab and select Save from the contextual menu. The following image shows the IDE window:
Select Errors in the margin at the bottom of the IDE window to open the Errors panel. Select the Build Output button.
Select Build > Build All from the menu.
The solution builds. The build output panel shows that the build is successful.
Unit tests provide automated software testing during your development and publishing. The testing framework that you use in this tutorial is xUnit (version 2.4.0 or later), which is installed automatically when the xUnit test project is added to the solution in the following steps:
In the Solution sidebar, ctrl-click the WordCounter
solution and select Add > Add New Project.
In the New Project dialog, select Tests from the .NET Core node. Select the xUnit Test Project followed by Next.
If you have multiple versions of the .NET Core SDK, you'll need to select the version for this project. Select .NET Core 3.1. Name the new project 'TestLibrary' and select Create.
In order for the test library to work with the WordCount
class, add a reference to the TextUtils
project. In the Solution sidebar, ctrl-click Dependencies under TestLibrary. Select Edit References from the context menu.
In the Edit References dialog, select the TextUtils project on the Projects tab. Select OK.
In the TestLibrary project, rename the UnitTest1.cs file to TextUtilsTests.cs.
Open the file and replace the code with the following code:
The following image shows the IDE with the unit test code in place. Pay attention to the Assert.NotEqual
statement.
It's important to make a new test fail once to confirm its testing logic is correct. The method passes in the name 'Jack' (uppercase) and a string with 'Jack' and 'jack' (uppercase and lowercase). If the GetWordCount
method is working properly, it returns a count of two instances of the search word. In order to fail this test on purpose, you first implement the test asserting that two instances of the search word 'Jack' aren't returned by the GetWordCount
method. Continue to the next step to fail the test on purpose.
Open the Unit Tests panel on the right side of the screen. Select View > Tests from the menu.
Click the Dock icon to keep the panel open. (Highlighted in the following image.)
Click the Run All button.
The test fails, which is the correct result. The test method asserts that two instances of the inputString
, 'Jack,' aren't returned from the string 'Jack jack' provided to the GetWordCount
method. Since word casing was factored out in the GetWordCount
method, two instances are returned. The assertion that 2 is not equal to 2 fails. This result is the correct outcome, and the logic of our test is good.
Modify the IgnoreCasing
test method by changing Assert.NotEqual
to Assert.Equal
. Save the file by using the keyboard shortcut Ctrl+s, File > Save from the menu, or ctrl-clicking on the file's tab and selecting Save from the context menu.
You expect that the searchWord
'Jack' returns two instances with inputString
'Jack jack' passed into GetWordCount
. Run the test again by clicking the Run Tests button in the Unit Tests panel or the Rerun Tests button in the Test Results panel at the bottom of the screen. The test passes. There are two instances of 'Jack' in the string 'Jack jack' (ignoring casing), and the test assertion is true
.
Testing individual return values with a Fact
is only the beginning of what you can do with unit testing. Another powerful technique allows you to test several values at once using a Theory
. Add the following method to your TextUtils_GetWordCountShould
class. You have two methods in the class after you add this method:
The CountInstancesCorrectly
checks that the GetWordCount
method counts correctly. The InlineData
provides a count, a search word, and an input string to check. The test method runs once for each line of data. Note once again that you're asserting a failure first by using Assert.NotEqual
, even when you know that the counts in the data are correct and that the values match the counts returned by the GetWordCount
method. Performing the step of failing the test on purpose might seem like a waste of time at first, but checking the logic of the test by failing it first is an important check on the logic of your tests. When you come across a test method that passes when you expect it to fail, you've found a bug in the logic of the test. It's worth the effort to take this step every time you create a test method.
Save the file and run the tests again. The casing test passes but the three count tests fail. This outcome is exactly what you expect to happen.
Modify the CountInstancesCorrectly
test method by changing Assert.NotEqual
to Assert.Equal
. Save the file. Run the tests again. All tests pass.
In the Solution sidebar, ctrl-click the WordCounter
solution. Add a new Console Application project by selecting the template from the .NET Core > App templates. Select Next. Name the project WordCounterApp. Select Create to create the project in the solution.
In the Solutions sidebar, ctrl-click the Dependencies node of the new WordCounterApp project. In the Edit References dialog, check TextUtils and select OK.
Open the Program.cs file. Replace the code with the following code:
Ctrl-click on the WordCounterApp
project and select Run project from the context menu. When you run the app, provide values for the search word and input string at the prompts in the console window. The app indicates the number of times the search word appears in the string.
The last feature to explore is debugging with Visual Studio for Mac. Set a breakpoint on the Console.WriteLine
statement: Select in the left margin of line 23, and you see a red circle appear next to the line of code. Alternatively, select anywhere on the line of code and select Run > Toggle Breakpoint from the menu.
ctrl-click the WordCounterApp
project. Select Start Debugging Project from the context menu. When the app runs, enter the search word 'cat' and 'The dog chased the cat, but the cat escaped.' for the string to search. When the Console.WriteLine
statement is reached, program execution halts before the statement is executed. In the Locals tab, you can see the searchWord
, inputString
, wordCount
, and pluralChar
values.
In the Immediate pane, type 'wordCount = 999;' and press Enter. This command assigns a nonsense value of 999 to the wordCount
variable showing that you can replace variable values while debugging.
In the toolbar, click the continue arrow. Look at the output in the console window. It reports the incorrect value of 999 that you set when you were debugging the app.
You can use the same process to debug code using your unit test project. Instead of starting the WordCount app project, ctrl-click the Test Library project, and select Start Debugging Project from the context menu. Visual Studio for Mac starts your test project with the debugger attached. Execution will stop at any breakpoint you've added to the test project, or the underlying library code.
Developer Community System Requirements Compatibility Distributable Code Documentation Blogs Servicing
Click the button to download the latest version of Visual Studio 2019 for Mac. For information on the system requirements see the see Mac System Requirementsand Mac Platform Targeting and Compatibility guides.
For instructions on installing and updating Visual Studio 2019 for Mac, see theInstall Visual Studio for Mac guide.
To learn more about other related downloads, see the Downloads page.
Broadcom sdio wifi driver for mac. The Visual Studio Blog is the official source of product insight from the Visual Studio Engineering Team. You can find in-depth information about the Visual Studio 2019 for Mac releases in the following posts:
Refer to the Known Issues section.
released March 3, 2020
This service release fixes the following issues:
released February 25, 2020
This service release addresses a number of additional accessibility issues and also fixes the following issues:
released February 19, 2020
This service release addresses a number of additional accessibility issues and also fixes the following issues:
released February 10, 2020
This service release fixes the following issues:
released February 4, 2020
This release of Visual Studio 2019 for Mac brings a refreshed color palette, new icons, and updated warning and error status messages. Color contrast ratios for text and icons have been increased to improve clarity. Visual Studio for Mac also now fully suports macOS High Contrast Mode.
In addition to the visual changes, this release of Visual Studio 2019 for Mac has made a number changes to increase overall accessibility of the IDE. These include:
This service release also fixes the following issues:
released January 28, 2020
This service release fixes the following issues:
released January 21, 2020
This service release fixes the following issues:
released January 14, 2020
This service release fixes the following issues:
released January 8, 2020
We made a number of changes to improve the accessibility of Visual Studio for Mac in this release including:
We have added a native and fully accessible (keyboard and VoiceOver) property pad control from the Android designer to the shelland enabled it by default for all solution items.
We fixed the following issues with the IDE:
We fixed the following issues with editing source code:
We fixed the following issues with .NET Core support:
We fixed the following issues with Azure Functions support:
We fixed the following issues with Version Control:
We fixed the following issues with Projects:
We fixed the following issues with Debugging:
We fixed the following issues with the Xamarin support:
We fixed the following issues with Testing:
We squashed a handful of behind-the-scenes bugs in the installer.
We fixed the following issues with the updater:
dotnet dev-certs https —clean
and then dotnet dev-certs https —trust
.We would love to hear from you! You can report a problem through the Report a Problem option in Visual Studio for Mac IDE.You can track your feedback, including suggestions, in the Developer Community portal.