{"id":347208,"date":"2023-05-04T12:27:43","date_gmt":"2023-05-04T11:27:43","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=dotnet&#038;p=347208"},"modified":"2023-05-24T13:57:30","modified_gmt":"2023-05-24T12:57:30","slug":"csharp-support-in-fleet-solution-view-unit-testing-and-more","status":"publish","type":"dotnet","link":"https:\/\/blog.jetbrains.com\/zh-hans\/dotnet\/2023\/05\/04\/csharp-support-in-fleet-solution-view-unit-testing-and-more","title":{"rendered":"C# Support in Fleet: Solution View, Unit Testing, and More!"},"content":{"rendered":"\n<p>Hello everyone!<\/p>\n\n\n\n<p>It\u2019s been a while since we published updates about <a href=\"https:\/\/blog.jetbrains.com\/zh-hans\/dotnet\/2022\/11\/17\/csharp-support-in-fleet\">C# support in Fleet<\/a>. In that post, we shared our plans to deliver new features for our C# support to improve your experience as a .NET developer.<\/p>\n\n\n\n<p>We\u2019d like to give you a quick update regarding which to-do list items have been completed. As a reminder, most of these new features are available only in Smart Mode.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1200\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2022\/11\/DSGN-14962_CSharp_support_in_Fleet_Blog_Featured_image_1280x600_02.png\" alt=\"\" class=\"wp-image-297298\"\/><\/figure>\n\n\n\n<p>To download Fleet, please install the\u00a0<a href=\"https:\/\/www.jetbrains.com\/toolbox-app\" target=\"_blank\" rel=\"noopener\">JetBrains Toolbox App<\/a>. You will see Fleet in the list of available tools.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution View<\/h2>\n\n\n\n<p>Let\u2019s start with a vital feature for C# developers \u2013 the Solution View.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Solution view tool window<\/h3>\n\n\n\n<p>If you open a solution (<code>.sln <\/code>file) or a <code>.cs<\/code> file from the Files view when Smart Mode is enabled, Solution View will be automatically focused.&nbsp;<\/p>\n\n\n\n<p>It shows you the solution structure you\u2019re used to observing in your IDE of choice, including a list of projects in the solution, solution folders, and project dependencies (both NuGet and other projects from the solution), but hiding technical subfolders (like <em>bin<\/em> and <em>obj<\/em> folders).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/solution-view-main.png\" alt=\"\" class=\"wp-image-347480\"\/><\/figure>\n\n\n\n<p>Now let\u2019s look separately at some additional features inside the Solution View that will simplify your daily .NET routine.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Build \/ Rebuild \/ Clean actions<\/h3>\n\n\n\n<p>Right from the Solution View, you can now build, rebuild, and clean your solution by calling the context menu for the solution node. For a project node, the <em>Build Project<\/em> action is also available to you.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1020\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/solution-view-build-actions.png\" alt=\"\" class=\"wp-image-347469\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Creating a new project<\/h3>\n\n\n\n<p>You can add a new project to a solution by calling the context menu on a solution node in the Solution View. It provides some basic functionality like specifying the name of the new project, providing a project folder to save the project, and setting a type of project with a list of predefined types.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1164\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/solution-view-new-project.png\" alt=\"\" class=\"wp-image-347491\"\/><\/figure>\n\n\n\n<p>The UI and UX for this new dialog are still under construction and are subject to change.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Open Solution<\/h3>\n\n\n\n<p>Fleet can&#8217;t determine which solution to open if there are either several <code>.sln<\/code> files in the open folder or several <code>.sln<\/code> files available in the subfolders. In this case, you can use the <em>Open Solution<\/em> action to specify which solution to work with. At any point, you can use this action to select another solution and add it to Solution View.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1600\" height=\"1000\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/solution-view-select-solution-file.png\" alt=\"\" class=\"wp-image-347691\"\/><\/figure>\n\n\n\n<p>If you want to close a particular solution, select the solution in Solution View and call the <em>Close active solution<\/em> action.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unit Testing<\/h2>\n\n\n\n<p>Unit testing is also a critical feature, as being able to run and debug your unit tests is essential in the development workflow. We\u2019ve now added Unit Testing functionality for C# to Fleet. Out of the box, Fleet supports the most common unit test frameworks: <em>NUnit<\/em>, <em>MSTests v2<\/em>, and <em>xUnit<\/em>.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Run unit tests for different scopes<\/h3>\n\n\n\n<p>You can run unit tests right from Solution View. A new <em>Run Unit Tests<\/em> action is available in the context menu for a solution node, project node, and any C# file.&nbsp;<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/unit-testing.png\" alt=\"Enable Smart mode in Fleet\" width=\"900\" data-gif-src=\"https:\/\/resources.jetbrains.com\/storage\/products\/blog\/wp-content\/uploads\/dotnet\/fleet-cs-unit-testing.gif\">\n\n\n\n<p>If you\u2019re used to seeing a green run icon for your unit test methods and classes in the code editor, we\u2019ve got you covered! You can run your tests right from the gutter margin, which can be useful if you want to run only a particular unit test or a set of tests inside a class.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/unit-testing-run-test.png\" alt=\"\" class=\"wp-image-347503\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Debug unit tests<\/h3>\n\n\n\n<p>The green \u201crun\u201d gutter icon is the most straightforward way to start debugging any unit test you want. Set a breakpoint in the unit test\u2019s code, click on the icon,&nbsp; select <code>Debug<\/code> in the menu, and Fleet will attach the debugger to your test. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/unit-testing-debug.png\" alt=\"\" class=\"wp-image-347594\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Run configurations for unit tests<\/h3>\n\n\n\n<p>If you run or debug unit tests, a new Run Configuration will be created and launched with a live presentation of the test execution reflecting the structure of the launched tests. There are three node statuses in the tree when the execution is complete: <code>Passed<\/code>, <code>Failed<\/code>, and <code>Ignored<\/code>.&nbsp;<\/p>\n\n\n\n<p>You can click the icons on the toolbar to quickly filter tests with a specific status.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/unit-testing-filter-1.png\" alt=\"\" class=\"wp-image-347654\"\/><\/figure>\n\n\n\n<p>When a test has failed, the Log pane shows the exact message from the assert method and a link to quickly navigate to the failed unit test. Also, for the ignored unit tests this pane shows a description of why the test was marked as <code>Ignored<\/code><\/p>\n\n\n\n<p>You can also rerun the Run Configuration with the test by clicking the <em>Rerun<\/em> icon on the toolbar once you\u2019ve fixed the failed test (or the code tested by the test). Even if you\u2019ve closed the <em>Run<\/em> tool window, you can still rerun the Run Configuration for the unit test via the <em>Run<\/em> applet on the main Fleet toolbar or the <code>Run | Run &amp; Debug<\/code> action from the main menu.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/unit-testing-run-configs.png\" alt=\"\" class=\"wp-image-347628\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Navigate to test source<\/h3>\n\n\n\n<p>Executing <code>Navigate to test source<\/code> from the context menu on a node in the unit test tree navigates you to the source code so that you can quickly get an idea of the test\u2019s purpose. Double left-clicking also allows you to navigate to a unit test source.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2048\" height=\"1280\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/image-7.png\" alt=\"\" class=\"wp-image-347209\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Better support for projects with multiple target frameworks&nbsp;<\/h2>\n\n\n\n<p>In the bottom right corner of the text editor, there is a new selector which allows you to select the target framework for an open file, which adds more context for the code analysis engine.&nbsp;<\/p>\n\n\n\n<img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/select-target-framework-1.png\" alt=\"Enable Smart mode in Fleet\" width=\"900\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/select-target-framework-1.gif\">\n\n\n\n<p>A similar selector exists for files belonging to a shared project, helping you select the proper context for this file.&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting up Solution Properties<\/h2>\n\n\n\n<p>Now you can set up project properties for a whole solution via the UI to configure MSBuild to compile and build your projects properly:<\/p>\n\n\n\n<ul>\n<li><strong>Configuration<\/strong>, generally <code>Debug<\/code> or <code>Release<\/code>.<\/li>\n\n\n\n<li><strong>Platform, <\/strong>generally <code>AnyCPU<\/code>, <code>x64<\/code>, <code>x86<\/code>, or <code>ARM64<\/code>.<\/li>\n<\/ul>\n\n\n\n<p>You can find them in the <code>Solution Properties<\/code> section on the <code>Configure Workspace<\/code> page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"2560\" height=\"1600\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/solution-properties.png\" alt=\"\" class=\"wp-image-347665\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">New shortcut keymaps<\/h2>\n\n\n\n<p>We have added two additional keymap schemes. Now, you can choose either the <code>Visual Studio<\/code> scheme on Windows or the <code>Visual Studio Code<\/code> scheme on Windows, macOS, and Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Broken Run Configurations<\/h2>\n\n\n\n<p>From time to time, everyone needs to demolish something that was implemented incorrectly and start rebuilding it from scratch. That\u2019s what happened here \u2013 we&#8217;ve reworked the format for .NET Run Configuration to make it more convenient and unified, minimized duplicated properties (like properties that are already specified inside the <code>launchSettings.json<\/code>), and added useful ones like <code>targetFramework<\/code> and <code>solutionPath<\/code>.&nbsp;<\/p>\n\n\n\n<p>If you have already installed the Fleet 1.18 update, all of your old custom .NET Run Configurations have stopped working and you will have to update them manually to support the new format depending on their types.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">&#8220;dotnet-launch-settings&#8221; type<\/h3>\n\n\n\n<p>If your custom Run Configuration has the <code>dotnet_launch_settings<\/code> type, you should do the following:<\/p>\n\n\n\n<ul>\n<li>Rename it to <code>dotnet-launch-settings<\/code>.<\/li>\n\n\n\n<li>Remove the <code>exePath<\/code>, <code>commandName<\/code>, and <code>commandLineArg<\/code> properties, which will be highlighted as errors on the <em>run.json<\/em> file.<\/li>\n\n\n\n<li>If you\u2019re working with a solution rather than a single project, you must specify a <code>solutionPath<\/code> property.<\/li>\n\n\n\n<li>Optionally, specify the <code>targetFramework<\/code> property.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1800\" height=\"1000\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2023\/05\/broken-run-configs.png\" alt=\"\" class=\"wp-image-347676\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">\u201cdotnet\u201d type&nbsp;<\/h3>\n\n\n\n<p>If your custom Run Configuration has the <em>dotnet<\/em> type, you should do the following:<\/p>\n\n\n\n<ul>\n<li>If you\u2019re working with a solution rather than a single project, you must specify a <code>solutionPath<\/code> property.<\/li>\n\n\n\n<li>Remove the <code>exePath<\/code> property, which will be highlighted as an error on the <code>run.json<\/code> file.<\/li>\n\n\n\n<li>Optionally, specify the <code>targetFramework<\/code> property.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">We\u2019d love to hear your feedback<\/h2>\n\n\n\n<p>We look forward to hearing your thoughts about Fleet in general and its C# support in particular. This will help us shape the product. Here are several feedback channels for you to use:<\/p>\n\n\n\n<ul>\n<li>Our&nbsp;<a href=\"https:\/\/youtrack.jetbrains.com\/issues?q=project:%20%7BFL%7D\" target=\"_blank\" rel=\"noopener\">issue tracker<\/a>. Feel free to submit your reports there.<\/li>\n\n\n\n<li>You are welcome to send your thoughts or issues to us at \u200b\u200b<a href=\"fleet-support@jetbrains.com\">fleet-support@jetbrains.com<\/a>.<\/li>\n<\/ul>\n","protected":false},"author":307,"featured_media":348825,"comment_status":"closed","ping_status":"closed","template":"","categories":[4992,89],"tags":[158,211,6834,3422,443],"cross-post-tag":[6910],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/347208"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/dotnet"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/307"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=347208"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/347208\/revisions"}],"predecessor-version":[{"id":357595,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/dotnet\/347208\/revisions\/357595"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/348825"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=347208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=347208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=347208"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=347208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}