« Visual studio 2019 » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
 
 
(11 versions intermédiaires par le même utilisateur non affichées)
Ligne 50 : Ligne 50 :
</filebox>
</filebox>
[https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019 Documentation]
[https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019 Documentation]
== [https://marketplace.visualstudio.com/items?itemName=vs-publisher-141975.SwitchStartupProject SwitchStartupProject] ==
Allow to switch easily from one startup project config to another.
<filebox fn='MySolution.sln.startup.json' collapsed>
{
  "Version": 3,
  "ListAllProjects": false,
  "MultiProjectConfigurations": {
    "A + B": {
      "Projects": {
        "MyProjectA": {},
        "MyProjectB": {}
      }
    }
  }
}
</filebox>


= Git =
= Git =
Ligne 56 : Ligne 76 :
# clique-droit sur la branche contenant le commit à appliquer → View History
# clique-droit sur la branche contenant le commit à appliquer → View History
# clique-droit sur le commit à appliquer → Cherry-pick
# clique-droit sur le commit à appliquer → Cherry-pick
== [https://www.thomasclaudiushuber.com/2019/04/10/the-git-stash-functionality-in-visual-studio-2019/ Stash] ==
{| class="wikitable wtp wtmono1"
|-
| Stash All || create a stash that contains all the uncommitted changes and remove the changes from the branch
|-
| Stash All and Keep Staged || create a stash that contains all the uncommitted changes and keep the changes in the branch
|-
| Apply || apply the changes to the branch and keep the stash
|-
| Pop || apply the changes to the branch and drop the stash
|-
| Drop || delete the stash
|-
| Pop/Apply and Restore Staged || pop/apply the changes to the branch and ensure that files that you had staged before are staged again
|-
| Pop/Apply All as Unstaged || pop/apply the changes to the branch and won’t stage the files that you had staged before
|}
= [https://stackoverflow.com/questions/12946476/where-is-the-iis-express-configuration-metabase-file-found IIS Express] =
* {{boxx|$(solutionDir)\.vs\{projectName}\config\applicationhost.config}}
* {{boxx|%userprofile%\Documents\IISExpress}}
== Virtual Directory ==
<filebox fn='$(solutionDir)\.vs\{projectName}\config\applicationhost.config' lang='xml'>
<configuration>
    <system.applicationHost>
        <sites>
            <site name="{projectName}" id="2">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="{projectPath}" />
                </application>
                <!-- new virtual directory -->
                <application path="/xxx" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="{projectPath}" />
                </application>
                <!-- -->
                <bindings>
                    <binding protocol="http" bindingInformation="*:{port}:localhost" />
                </bindings>
            </site>
</filebox>


= Windows Defender =
= Windows Defender =
Ligne 64 : Ligne 126 :


= [https://docs.microsoft.com/en-us/visualstudio/ide/class-designer/how-to-add-class-diagrams-to-projects?view=vs-2019 Class Designer] =
= [https://docs.microsoft.com/en-us/visualstudio/ide/class-designer/how-to-add-class-diagrams-to-projects?view=vs-2019 Class Designer] =
* Install the tool: Visual Studio Installer → .NET desktop development → Optional → Architecture and analysis tools
* Create a diagram: right-click on a project → Add → New Item → Visual C# Items → General → Class Diagram
* Add existing classes: display View → Class View
* Display link between 2 existing classes: right-click on the property → Show as (Collection) Association
== Old ==
* Ajouter Class Designer: Visual Studio Installer → Individual components → Code tools category → Class Designer
* Ajouter Class Designer: Visual Studio Installer → Individual components → Code tools category → Class Designer
* Créer un diagramme: clique-droit sur un projet → Add → New Item → Visual C# Items → General → Class Diagram
* Créer un diagramme: clique-droit sur un projet → Add → New Item → Visual C# Items → General → Class Diagram
* Ajouter des classes existantes: afficher View → Class View
* Ajouter des classes existantes: afficher View → Class View
* Afficher une liaison déjà existante entre 2 classes: clique-droit sur la propriété → Show as (Collection) Association
* Afficher une liaison déjà existante entre 2 classes: clique-droit sur la propriété → Show as (Collection) Association
= [https://stackoverflow.com/questions/1876059/visual-studio-where-does-it-store-set-as-startup-project Startup projects] =
* By default, it is the first project listed in the {{boxx|sln}} file
* Then the user choice is stored in the binary file {{boxx|.vs\SolutionName\v16\.suo}}

Dernière version du 24 mai 2022 à 09:03

Raccourcis clavier - shortcuts

Ctrl + M + O collapse (Edit → Outlining → Collapse to Definitions)
Ctrl + J afficher l'IntelliSense
Ctrl + Shift + Space afficher le tooltip des signatures des méthodes
Ctrl + L
Shift + Delete
couper la ligne courante
Ctrl + Shift + L supprimer la ligne courante

Debug

Ctrl + F10 Run to Cursor - Run the code until the cursor.
Alt + * Go to the current statement.

Extensions

Productivity Power Tools 2017/2019

  • Format document on save
  • Remove and sort usings on save

XAML Styler

Tools → Options → XAML Styler

Attribute tolerance 1 nombre max d'attributs sur une ligne
Keep first attribute on the same line True premier attribut sur la même ligne que sa balise
Enable attribute reordering False
Order attributes by name False
Comment padding 1

EditorConfig Language Service

Créer un nouveau fichier .editorconfig: clique-droit sur la solution → Add → .editorconfig File

.editorconfig
[*]
insert_final_newline = true

Documentation

SwitchStartupProject

Allow to switch easily from one startup project config to another.

MySolution.sln.startup.json
{
  "Version": 3,
  "ListAllProjects": false,
  "MultiProjectConfigurations": {

    "A + B": {
      "Projects": {
        "MyProjectA": {},
        "MyProjectB": {}
      }
    }

  }
}

Git

Cherry-pick

  1. Team Explorer → Branches → checkout de la branche de destination
  2. clique-droit sur la branche contenant le commit à appliquer → View History
  3. clique-droit sur le commit à appliquer → Cherry-pick

Stash

Stash All create a stash that contains all the uncommitted changes and remove the changes from the branch
Stash All and Keep Staged create a stash that contains all the uncommitted changes and keep the changes in the branch
Apply apply the changes to the branch and keep the stash
Pop apply the changes to the branch and drop the stash
Drop delete the stash
Pop/Apply and Restore Staged pop/apply the changes to the branch and ensure that files that you had staged before are staged again
Pop/Apply All as Unstaged pop/apply the changes to the branch and won’t stage the files that you had staged before

IIS Express

  • $(solutionDir)\.vs\{projectName}\config\applicationhost.config
  • %userprofile%\Documents\IISExpress

Virtual Directory

$(solutionDir)\.vs\{projectName}\config\applicationhost.config
<configuration>
    <system.applicationHost>
        <sites>
            <site name="{projectName}" id="2">
                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="{projectPath}" />
                </application>
                <!-- new virtual directory -->
                <application path="/xxx" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="{projectPath}" />
                </application>
                <!-- -->
                <bindings>
                    <binding protocol="http" bindingInformation="*:{port}:localhost" />
                </bindings>
            </site>

Windows Defender

Exclure les dossiers suivant:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
  • %LOCALAPPDATA%\JetBrains\Transient (ReSharper cache)
  • Projects folder

Class Designer

  • Install the tool: Visual Studio Installer → .NET desktop development → Optional → Architecture and analysis tools
  • Create a diagram: right-click on a project → Add → New Item → Visual C# Items → General → Class Diagram
  • Add existing classes: display View → Class View
  • Display link between 2 existing classes: right-click on the property → Show as (Collection) Association

Old

  • Ajouter Class Designer: Visual Studio Installer → Individual components → Code tools category → Class Designer
  • Créer un diagramme: clique-droit sur un projet → Add → New Item → Visual C# Items → General → Class Diagram
  • Ajouter des classes existantes: afficher View → Class View
  • Afficher une liaison déjà existante entre 2 classes: clique-droit sur la propriété → Show as (Collection) Association

Startup projects

  • By default, it is the first project listed in the sln file
  • Then the user choice is stored in the binary file .vs\SolutionName\v16\.suo