<h1><a name="p-87-guide-ressources-developpeurs-net-vs-code-powershell-github-1" class="anchor" href="#p-87-guide-ressources-developpeurs-net-vs-code-powershell-github-1" aria-label="Heading link"></a>[GUIDE] Ressources developpeurs .NET, VS Code, PowerShell, GitHub</h1>
<blockquote>
<p>Guide complet des outils, frameworks et bonnes pratiques pour les developpeurs de l’ecosysteme Microsoft. De .NET 9 a GitHub Copilot, en passant par PowerShell et Azure DevOps.</p>
</blockquote>
<hr>
<h2><a name="p-87-h-1-net-c-lecosysteme-moderne-2" class="anchor" href="#p-87-h-1-net-c-lecosysteme-moderne-2" aria-label="Heading link"></a>1. .NET & C# — L’ecosysteme moderne</h2>
<h3><a name="p-87-net-9-nouveautes-majeures-3" class="anchor" href="#p-87-net-9-nouveautes-majeures-3" aria-label="Heading link"></a>.NET 9 — Nouveautes majeures</h3>
<p>.NET 9 (novembre 2024) apporte des ameliorations significatives :</p>
<ul>
<li><strong>Performances</strong> : amelioration du JIT, du GC (Garbage Collector) et du runtime</li>
<li><strong>AOT natif</strong> : compilation Ahead-of-Time pour les API minimales, applications console et workers</li>
<li><strong>Serialisation JSON</strong> : <code>System.Text.Json</code> ameliore avec le support des types supplementaires</li>
<li><strong>LINQ</strong> : nouvelles methodes <code>CountBy</code>, <code>AggregateBy</code>, <code>Index</code></li>
<li><strong>Bibliotheque de base</strong> : <code>TimeProvider</code> pour les tests temporels, <code>SearchValues</code> pour la recherche optimisee</li>
</ul>
<pre data-code-wrap="csharp"><code class="lang-csharp">// Exemple .NET 9 : CountBy et AggregateBy
var mots = new[] { "bonjour", "monde", "bonjour", "france", "monde", "monde" };
foreach (var (mot, count) in mots.CountBy(m => m))
{
Console.WriteLine($"{mot} : {count} fois");
}
</code></pre>
<h3><a name="p-87-aspnet-core-4" class="anchor" href="#p-87-aspnet-core-4" aria-label="Heading link"></a><a href="http://ASP.NET">ASP.NET</a> Core</h3>
<div class="md-table">
<table>
<thead>
<tr>
<th>Framework</th>
<th>Usage</th>
<th>Quand l’utiliser</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>API minimale</strong></td>
<td>API REST legeres</td>
<td>Microservices, API simples</td>
</tr>
<tr>
<td><strong>API Controllers</strong></td>
<td>API REST completes</td>
<td>API complexes avec conventions</td>
</tr>
<tr>
<td><strong>MVC</strong></td>
<td>Sites web avec vues Razor</td>
<td>Applications web traditionnelles</td>
</tr>
<tr>
<td><strong>Blazor Server</strong></td>
<td>SPA cote serveur</td>
<td>Apps interactives, connexion permanente</td>
</tr>
<tr>
<td><strong>Blazor WebAssembly</strong></td>
<td>SPA cote client</td>
<td>Apps offline, distribution CDN</td>
</tr>
<tr>
<td><strong>Blazor United (.NET 8+)</strong></td>
<td>Rendu hybride SSR + interactif</td>
<td>Nouveau standard recommande</td>
</tr>
</tbody>
</table>
</div><pre data-code-wrap="csharp"><code class="lang-csharp">// API minimale .NET 9
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<AppDbContext>();
var app = builder.Build();
app.MapGet("/api/produits", async (AppDbContext db) =>
await db.Produits.ToListAsync());
app.MapPost("/api/produits", async (Produit produit, AppDbContext db) =>
{
db.Produits.Add(produit);
await db.SaveChangesAsync();
return Results.Created($"/api/produits/{produit.Id}", produit);
});
app.Run();
</code></pre>
<h3><a name="p-87-net-maui-applications-cross-platform-5" class="anchor" href="#p-87-net-maui-applications-cross-platform-5" aria-label="Heading link"></a>.NET MAUI — Applications cross-platform</h3>
<p>.NET MAUI (Multi-platform App UI) permet de creer des applications natives pour Windows, macOS, Android et iOS avec un seul code C# :</p>
<pre data-code-wrap="csharp"><code class="lang-csharp">// Page MAUI simple
public class MainPage : ContentPage
{
public MainPage()
{
Content = new VerticalStackLayout
{
new Label { Text = "Bienvenue sur MAUI !", FontSize = 24 },
new Button { Text = "Cliquez-moi", Command = new Command(() =>
DisplayAlert("Info", "MAUI fonctionne !", "OK")) }
};
}
}
</code></pre>
<h3><a name="p-87-entity-framework-core-6" class="anchor" href="#p-87-entity-framework-core-6" aria-label="Heading link"></a>Entity Framework Core</h3>
<pre data-code-wrap="csharp"><code class="lang-csharp">// Migration EF Core
// 1. Ajouter une migration
// dotnet ef migrations add InitialCreate
// 2. Appliquer a la base de donnees
// dotnet ef database update
public class AppDbContext : DbContext
{
public DbSet<Produit> Produits => Set<Produit>();
public DbSet<Categorie> Categories => Set<Categorie>();
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlServer("Server=.;Database=MaBase;Trusted_Connection=true;TrustServerCertificate=true;");
}
</code></pre>
<h3><a name="p-87-migration-net-framework-vers-net-moderne-7" class="anchor" href="#p-87-migration-net-framework-vers-net-moderne-7" aria-label="Heading link"></a>Migration .NET Framework vers .NET moderne</h3>
<ol>
<li>Utilisez l’outil <strong>upgrade-assistant</strong> :</li>
</ol>
<pre data-code-wrap="bash"><code class="lang-bash">dotnet tool install -g upgrade-assistant
upgrade-assistant upgrade ./MonProjet.sln
</code></pre>
<ol start="2">
<li>Analysez les incompatibilites avec <strong>apiport</strong> (API Portability Analyzer)</li>
<li>Migrez les packages NuGet <code>System.Web</code> vers les equivalents <a href="http://ASP.NET">ASP.NET</a> Core</li>
<li>Remplacez <code>Web.config</code> par <code>appsettings.json</code></li>
<li>Convertissez <code>Global.asax</code> vers <code>Program.cs</code> / <code>Startup.cs</code></li>
</ol>
<hr>
<h2><a name="p-87-h-2-visual-studio-productivite-maximale-8" class="anchor" href="#p-87-h-2-visual-studio-productivite-maximale-8" aria-label="Heading link"></a>2. Visual Studio — Productivite maximale</h2>
<h3><a name="p-87-raccourcis-essentiels-9" class="anchor" href="#p-87-raccourcis-essentiels-9" aria-label="Heading link"></a>Raccourcis essentiels</h3>
<div class="md-table">
<table>
<thead>
<tr>
<th>Raccourci</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Ctrl+Maj+B</code></td>
<td>Compiler la solution</td>
</tr>
<tr>
<td><code>F5</code> / <code>Ctrl+F5</code></td>
<td>Demarrer avec/sans debogage</td>
</tr>
<tr>
<td><code>Ctrl+.</code></td>
<td>Actions rapides et refactoring</td>
</tr>
<tr>
<td><code>Ctrl+T</code></td>
<td>Rechercher fichiers, types, membres</td>
</tr>
<tr>
<td><code>Ctrl+Maj+F</code></td>
<td>Rechercher dans tous les fichiers</td>
</tr>
<tr>
<td><code>F12</code></td>
<td>Aller a la definition</td>
</tr>
<tr>
<td><code>Alt+F12</code></td>
<td>Definition en apercu (peek)</td>
</tr>
<tr>
<td><code>Ctrl+K, Ctrl+D</code></td>
<td>Formater le document</td>
</tr>
<tr>
<td><code>Ctrl+K, Ctrl+C/U</code></td>
<td>Commenter/Decommenter</td>
</tr>
<tr>
<td><code>Ctrl+R, Ctrl+R</code></td>
<td>Renommer (refactoring)</td>
</tr>
<tr>
<td><code>Maj+Alt+Entree</code></td>
<td>Plein ecran</td>
</tr>
<tr>
<td><code>Ctrl+Maj+V</code></td>
<td>Historique du presse-papiers</td>
</tr>
</tbody>
</table>
</div><h3><a name="p-87-extensions-indispensables-10" class="anchor" href="#p-87-extensions-indispensables-10" aria-label="Heading link"></a>Extensions indispensables</h3>
<ul>
<li><strong>ReSharper</strong> : analyse de code avancee, refactoring puissant</li>
<li><strong>CodeMaid</strong> : nettoyage et organisation du code</li>
<li><strong>Fine Code Coverage</strong> : couverture de code gratuite</li>
<li><strong>GitHub Copilot</strong> : suggestions IA en temps reel</li>
<li><strong>Markdown Editor</strong> : edition Markdown avec apercu</li>
<li><strong>SlowCheetah</strong> : transformations de fichiers de configuration</li>
</ul>
<h3><a name="p-87-debogage-avance-11" class="anchor" href="#p-87-debogage-avance-11" aria-label="Heading link"></a>Debogage avance</h3>
<pre data-code-wrap="csharp"><code class="lang-csharp">// Breakpoint conditionnel : clic droit sur le breakpoint > Conditions
// Expression : produit.Prix > 100 && produit.Stock == 0
// Point de trace (Tracepoint) : affiche un message sans arreter l'execution
// Message : "Produit {produit.Nom} - Prix: {produit.Prix}"
// DebuggerDisplay pour un affichage personnalise dans le debogueur
[DebuggerDisplay("{Nom} (Id={Id}, Prix={Prix}€)")]
public class Produit
{
public int Id { get; set; }
public string Nom { get; set; }
public decimal Prix { get; set; }
}
</code></pre>
<ul>
<li><strong>IntelliTrace</strong> (Enterprise) : enregistrement de l’historique d’execution pour revenir en arriere dans le debogage</li>
<li><strong>Profiling</strong> : Debogage > Profileur de performances > choisir CPU, memoire, base de donnees</li>
</ul>
<hr>
<h2><a name="p-87-h-3-vs-code-lediteur-incontournable-12" class="anchor" href="#p-87-h-3-vs-code-lediteur-incontournable-12" aria-label="Heading link"></a>3. VS Code — L’editeur incontournable</h2>
<h3><a name="p-87-extensions-microsoft-recommandees-13" class="anchor" href="#p-87-extensions-microsoft-recommandees-13" aria-label="Heading link"></a>Extensions Microsoft recommandees</h3>
<div class="md-table">
<table>
<thead>
<tr>
<th>Extension</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>C# Dev Kit</strong></td>
<td>IntelliSense, debogage, tests pour C#</td>
</tr>
<tr>
<td><strong>PowerShell</strong></td>
<td>Edition et debogage PowerShell</td>
</tr>
<tr>
<td><strong>Azure Tools</strong></td>
<td>Pack complet pour Azure (Functions, App Service, Storage…)</td>
</tr>
<tr>
<td><strong>GitHub Copilot</strong></td>
<td>Autocompletion IA</td>
</tr>
<tr>
<td><strong>GitHub Copilot Chat</strong></td>
<td>Chat IA integre dans l’editeur</td>
</tr>
<tr>
<td><strong>Remote - SSH</strong></td>
<td>Developper sur un serveur distant</td>
</tr>
<tr>
<td><strong>Remote - WSL</strong></td>
<td>Developper dans WSL</td>
</tr>
<tr>
<td><strong>Dev Containers</strong></td>
<td>Developper dans des conteneurs Docker</td>
</tr>
<tr>
<td><strong>Python</strong></td>
<td>Support complet Python</td>
</tr>
<tr>
<td><strong>Thunder Client</strong></td>
<td>Client REST API integre</td>
</tr>
<tr>
<td><strong>Live Share</strong></td>
<td>Collaboration en temps reel</td>
</tr>
</tbody>
</table>
</div><h3><a name="p-87-settingsjson-optimise-14" class="anchor" href="#p-87-settingsjson-optimise-14" aria-label="Heading link"></a>settings.json optimise</h3>
<pre data-code-wrap="json"><code class="lang-json">{
"editor.fontSize": 14,
"editor.fontFamily": "'Cascadia Code', 'Fira Code', Consolas, monospace",
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.minimap.enabled": false,
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"editor.stickyScroll.enabled": true,
"editor.inlineSuggest.enabled": true,
"terminal.integrated.defaultProfile.windows": "PowerShell",
"terminal.integrated.fontFamily": "'Cascadia Mono', Consolas",
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"workbench.colorTheme": "Default Dark Modern",
"git.autofetch": true,
"git.confirmSync": false,
"omnisharp.enableRoslynAnalyzers": true,
"dotnet.defaultSolution": "auto",
"[csharp]": {
"editor.defaultFormatter": "ms-dotnettools.csharp"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
</code></pre>
<h3><a name="p-87-multi-root-workspaces-15" class="anchor" href="#p-87-multi-root-workspaces-15" aria-label="Heading link"></a>Multi-root Workspaces</h3>
<p>Creez un fichier <code>.code-workspace</code> pour regrouper plusieurs projets :</p>
<pre data-code-wrap="json"><code class="lang-json">{
"folders": [
{ "path": "./frontend", "name": "Frontend React" },
{ "path": "./backend", "name": "API .NET" },
{ "path": "./shared", "name": "Bibliotheque partagee" }
],
"settings": {
"dotnet.defaultSolution": "backend/MonAPI.sln"
}
}
</code></pre>
<h3><a name="p-87-remote-development-16" class="anchor" href="#p-87-remote-development-16" aria-label="Heading link"></a>Remote Development</h3>
<ul>
<li><strong>SSH</strong> : <code>Ctrl+Maj+P</code> > “Remote-SSH: Connect to Host” — developpez sur un serveur Linux distant</li>
<li><strong>WSL</strong> : ouvrez un dossier WSL directement — <code>code /mnt/c/projets/monapp</code> depuis WSL</li>
<li><strong>Dev Containers</strong> : ajoutez un <code>.devcontainer/devcontainer.json</code> pour un environnement reproductible</li>
</ul>
<hr>
<h2><a name="p-87-h-4-powershell-automatisation-et-scripts-17" class="anchor" href="#p-87-h-4-powershell-automatisation-et-scripts-17" aria-label="Heading link"></a>4. PowerShell — Automatisation et scripts</h2>
<h3><a name="p-87-scripts-dautomatisation-courants-18" class="anchor" href="#p-87-scripts-dautomatisation-courants-18" aria-label="Heading link"></a>Scripts d’automatisation courants</h3>
<pre data-code-wrap="powershell"><code class="lang-powershell"># Inventaire des logiciels installes
Get-CimInstance -ClassName Win32_Product |
Select-Object Name, Version, Vendor |
Sort-Object Name |
Export-Csv "$env:USERPROFILE\Desktop\logiciels.csv" -NoTypeInformation -Encoding UTF8
Nettoyage des fichiers temporaires
$dossiers = @("$env:TEMP", "$env:SystemRoot\Temp", "$env:SystemRoot\Prefetch")
foreach ($dossier in $dossiers) {
Get-ChildItem $dossier -Recurse -Force -ErrorAction SilentlyContinue |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-7) } |
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
}
Write-Host "Nettoyage termine." -ForegroundColor Green
Surveillance d'un service avec redemarrage automatique
$service = "Spooler"
if ((Get-Service $service).Status -ne 'Running') {
Start-Service $service
Send-MailMessage -To "admin@example.com" -From "alert@example.com" `
-Subject "Service $service redemarre" -SmtpServer "smtp.example.com"
}
</code></pre>
<h3><a name="p-87-modules-essentiels-19" class="anchor" href="#p-87-modules-essentiels-19" aria-label="Heading link"></a>Modules essentiels</h3>
<div class="md-table">
<table>
<thead>
<tr>
<th>Module</th>
<th>Usage</th>
<th>Installation</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Az</strong></td>
<td>Gestion Azure</td>
<td><code>Install-Module Az</code></td>
</tr>
<tr>
<td><strong>Microsoft.Graph</strong></td>
<td>API Microsoft 365</td>
<td><code>Install-Module Microsoft.Graph</code></td>
</tr>
<tr>
<td><strong>ActiveDirectory</strong></td>
<td>Gestion AD DS</td>
<td>Fonctionnalite RSAT</td>
</tr>
<tr>
<td><strong>ImportExcel</strong></td>
<td>Lire/ecrire Excel sans Office</td>
<td><code>Install-Module ImportExcel</code></td>
</tr>
<tr>
<td><strong>Pester</strong></td>
<td>Tests unitaires PowerShell</td>
<td><code>Install-Module Pester</code></td>
</tr>
<tr>
<td><strong>PSScriptAnalyzer</strong></td>
<td>Linter PowerShell</td>
<td><code>Install-Module PSScriptAnalyzer</code></td>
</tr>
<tr>
<td><strong>Terminal-Icons</strong></td>
<td>Icones dans le terminal</td>
<td><code>Install-Module Terminal-Icons</code></td>
</tr>
</tbody>
</table>
</div><h3><a name="p-87-profil-powershell-20" class="anchor" href="#p-87-profil-powershell-20" aria-label="Heading link"></a>Profil PowerShell</h3>
<pre data-code-wrap="powershell"><code class="lang-powershell"># Editer le profil : notepad $PROFILE
Contenu recommande :
Modules
Import-Module Terminal-Icons
Import-Module posh-git
Alias utiles
Set-Alias -Name g -Value git
Set-Alias -Name k -Value kubectl
Set-Alias -Name tf -Value terraform
Fonctions personnalisees
function which($name) { Get-Command $name -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Path }
function mkcd($path) { New-Item -ItemType Directory -Path $path -Force; Set-Location $path }
function tail { Get-Content -Tail 20 -Wait @args }
Prompt personnalise avec Oh My Posh
oh-my-posh init pwsh --config "$env😛OSH_THEMES_PATH\paradox.omp.json" | Invoke-Expression
</code></pre>
<h3><a name="p-87-pester-tests-unitaires-21" class="anchor" href="#p-87-pester-tests-unitaires-21" aria-label="Heading link"></a>Pester — Tests unitaires</h3>
<pre data-code-wrap="powershell"><code class="lang-powershell"># Fichier : Get-Factorielle.Tests.ps1
Describe "Get-Factorielle" {
It "Retourne 1 pour 0" {
Get-Factorielle -Nombre 0 | Should -Be 1
}
It "Retourne 120 pour 5" {
Get-Factorielle -Nombre 5 | Should -Be 120
}
It "Lance une erreur pour un nombre negatif" {
{ Get-Factorielle -Nombre -1 } | Should -Throw
}
}
Executer : Invoke-Pester ./Get-Factorielle.Tests.ps1 -Output Detailed
</code></pre>
<hr>
<h2><a name="p-87-h-5-github-github-copilot-22" class="anchor" href="#p-87-h-5-github-github-copilot-22" aria-label="Heading link"></a>5. GitHub & GitHub Copilot</h2>
<h3><a name="p-87-git-workflow-recommande-23" class="anchor" href="#p-87-git-workflow-recommande-23" aria-label="Heading link"></a>Git workflow recommande</h3>
<pre data-code-wrap="bash"><code class="lang-bash"># Creer une branche feature
git checkout -b feature/ma-fonctionnalite
Travailler, committer regulierement
git add .
git commit -m "feat: ajout du module d'authentification"
Pousser et creer une Pull Request
git push -u origin feature/ma-fonctionnalite
gh pr create --title "feat: module authentification" --body "Description detaillee..."
Apres la revue de code, fusionner
gh pr merge --squash --delete-branch
</code></pre>
<p><strong>Conventions de commit</strong> (Conventional Commits) :</p>
<ul>
<li><code>feat:</code> — nouvelle fonctionnalite</li>
<li><code>fix:</code> — correction de bug</li>
<li><code>docs:</code> — documentation</li>
<li><code>refactor:</code> — refactoring sans changement fonctionnel</li>
<li><code>test:</code> — ajout ou modification de tests</li>
<li><code>chore:</code> — maintenance (dependances, CI, config)</li>
</ul>
<h3><a name="p-87-github-actions-cicd-24" class="anchor" href="#p-87-github-actions-cicd-24" aria-label="Heading link"></a>GitHub Actions — CI/CD</h3>
<pre data-code-wrap="yaml"><code class="lang-yaml"># .github/workflows/dotnet.yml
name: .NET CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restaurer les dependances
run: dotnet restore
- name: Compiler
run: dotnet build --no-restore --configuration Release
- name: Tests
run: dotnet test --no-build --configuration Release --verbosity normal
--collect:"XPlat Code Coverage"
- name: Publier
if: github.ref == 'refs/heads/main'
run: dotnet publish -c Release -o ./publish
- name: Deployer sur Azure
if: github.ref == 'refs/heads/main'
uses: azure/webapps-deploy@v3
with:
app-name: 'mon-api-production'
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
package: ./publish
</code></pre>
<h3><a name="p-87-github-copilot-prompts-efficaces-25" class="anchor" href="#p-87-github-copilot-prompts-efficaces-25" aria-label="Heading link"></a>GitHub Copilot — Prompts efficaces</h3>
<ul>
<li><strong>Commentaire descriptif</strong> : ecrivez un commentaire clair avant le code, Copilot generera l’implementation</li>
<li><strong>Chat inline</strong> : <code>Ctrl+I</code> pour demander une modification dans le contexte du fichier</li>
<li><strong>Commandes slash</strong> :
<ul>
<li><code>/explain</code> — expliquer le code selectionne</li>
<li><code>/fix</code> — corriger un bug</li>
<li><code>/tests</code> — generer des tests unitaires</li>
<li><code>/doc</code> — generer la documentation</li>
<li><code>@workspace</code> — poser une question sur tout le projet</li>
</ul>
</li>
</ul>
<h3><a name="p-87-github-codespaces-26" class="anchor" href="#p-87-github-codespaces-26" aria-label="Heading link"></a>GitHub Codespaces</h3>
<p>Environnement de developpement cloud complet base sur VS Code :</p>
<ul>
<li>Disponible en quelques secondes depuis n’importe quel depot</li>
<li>Configuration via <code>.devcontainer/devcontainer.json</code></li>
<li>60 heures/mois gratuites pour les comptes personnels</li>
<li>Forwarding de ports automatique pour les applications web</li>
</ul>
<hr>
<h2><a name="p-87-h-6-sql-server-27" class="anchor" href="#p-87-h-6-sql-server-27" aria-label="Heading link"></a>6. SQL Server</h2>
<h3><a name="p-87-requetes-doptimisation-essentielles-28" class="anchor" href="#p-87-requetes-doptimisation-essentielles-28" aria-label="Heading link"></a>Requetes d’optimisation essentielles</h3>
<pre data-code-wrap="sql"><code class="lang-sql">-- Top 10 des requetes les plus couteuses en CPU
SELECT TOP 10
qs.total_worker_time / qs.execution_count AS avg_cpu_time,
qs.execution_count,
SUBSTRING(qt.text, (qs.statement_start_offset/2) + 1,
((CASE qs.statement_end_offset
WHEN -1 THEN DATALENGTH(qt.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset) / 2) + 1) AS query_text
FROM sys.dm_exec_query_stats qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt
ORDER BY avg_cpu_time DESC;
-- Index manquants suggeres par SQL Server
SELECT
d.name AS base_de_donnees,
OBJECT_NAME(mid.object_id, mid.database_id) AS table_name,
mid.equality_columns,
mid.inequality_columns,
mid.included_columns,
migs.avg_user_impact AS amelioration_estimee_pct
FROM sys.dm_db_missing_index_details mid
JOIN sys.dm_db_missing_index_groups mig ON mid.index_handle = mig.index_handle
JOIN sys.dm_db_missing_index_group_stats migs ON mig.index_group_handle = migs.group_handle
JOIN sys.databases d ON mid.database_id = d.database_id
ORDER BY migs.avg_user_impact DESC;
</code></pre>
<h3><a name="p-87-sauvegarde-et-restauration-29" class="anchor" href="#p-87-sauvegarde-et-restauration-29" aria-label="Heading link"></a>Sauvegarde et restauration</h3>
<pre data-code-wrap="sql"><code class="lang-sql">-- Sauvegarde complete
BACKUP DATABASE MaBase TO DISK = 'C:\Backups\MaBase_Full.bak'
WITH COMPRESSION, CHECKSUM, INIT;
-- Restauration
RESTORE DATABASE MaBase FROM DISK = 'C:\Backups\MaBase_Full.bak'
WITH RECOVERY, REPLACE,
MOVE 'MaBase' TO 'C:\Data\MaBase.mdf',
MOVE 'MaBase_Log' TO 'C:\Data\MaBase_log.ldf';
</code></pre>
<hr>
<h2><a name="p-87-h-7-azure-devops-30" class="anchor" href="#p-87-h-7-azure-devops-30" aria-label="Heading link"></a>7. Azure DevOps</h2>
<h3><a name="p-87-pipeline-yaml-type-31" class="anchor" href="#p-87-pipeline-yaml-type-31" aria-label="Heading link"></a>Pipeline YAML type</h3>
<pre data-code-wrap="yaml"><code class="lang-yaml"># azure-pipelines.yml
trigger:
branches:
include:
- main
- develop
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
dotnetVersion: '9.0.x'
stages:
Lister les packages obsoletes
dotnet list package --outdated
Mettre a jour tous les packages
dotnet outdated --upgrade # necessite dotnet-outdated-tool
</code></pre>
<h3><a name="p-87-docker-pour-developpeurs-net-35" class="anchor" href="#p-87-docker-pour-developpeurs-net-35" aria-label="Heading link"></a>Docker pour developpeurs .NET</h3>
<pre data-code-wrap="dockerfile"><code class="lang-dockerfile"># Dockerfile multi-stage pour une API .NET
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
COPY --from=build /app ./
EXPOSE 8080
ENTRYPOINT ["dotnet", "MonAPI.dll"]
</code></pre>
<pre data-code-wrap="bash"><code class="lang-bash"># Construire et executer
docker build -t mon-api .
docker run -d -p 8080:8080 --name mon-api-container mon-api
</code></pre>
<h3><a name="p-87-windows-terminal-wsl2-36" class="anchor" href="#p-87-windows-terminal-wsl2-36" aria-label="Heading link"></a>Windows Terminal & WSL2</h3>
<ul>
<li>Installez <strong>Windows Terminal</strong> depuis le Microsoft Store</li>
<li>Ajoutez des profils pour PowerShell, CMD, WSL (Ubuntu), Azure Cloud Shell</li>
<li>WSL2 : <code>wsl --install</code> pour installer Ubuntu, puis <code>wsl --set-default-version 2</code></li>
<li>Interoperabilite : accedez aux fichiers Windows depuis WSL via <code>/mnt/c/</code> et aux fichiers WSL depuis Windows via <code>\wsl$</code></li>
</ul>
<hr>
<h2><a name="p-87-h-9-certifications-developpeur-microsoft-37" class="anchor" href="#p-87-h-9-certifications-developpeur-microsoft-37" aria-label="Heading link"></a>9. Certifications developpeur Microsoft</h2>
<div class="md-table">
<table>
<thead>
<tr>
<th>Certification</th>
<th>Sujet</th>
<th>Niveau</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>AZ-204</strong></td>
<td>Developpement de solutions Azure</td>
<td>Associe</td>
</tr>
<tr>
<td><strong>AZ-400</strong></td>
<td>Solutions DevOps Azure</td>
<td>Expert</td>
</tr>
<tr>
<td><strong>MS-600</strong></td>
<td>Applications et solutions Microsoft 365</td>
<td>Associe</td>
</tr>
<tr>
<td><strong>AI-102</strong></td>
<td>Solutions IA Azure</td>
<td>Associe</td>
</tr>
<tr>
<td><strong>DP-420</strong></td>
<td>Azure Cosmos DB</td>
<td>Specialite</td>
</tr>
</tbody>
</table>
</div><p><strong>Ressources gratuites</strong> :</p>
<ul>
<li><a href="https://learn.microsoft.com">Microsoft Learn</a> : parcours d’apprentissage gratuits et interactifs</li>
<li><a href="https://dotnet.microsoft.com/learn">.NET Learn</a> : tutoriels debutants a avances</li>
<li><strong>Microsoft Virtual Training Days</strong> : sessions gratuites avec bon d’examen parfois inclus</li>
</ul>
<hr>
<h2><a name="p-87-h-10-tableau-recapitulatif-des-commandes-38" class="anchor" href="#p-87-h-10-tableau-recapitulatif-des-commandes-38" aria-label="Heading link"></a>10. Tableau recapitulatif des commandes</h2>
<h3><a name="p-87-dotnet-cli-39" class="anchor" href="#p-87-dotnet-cli-39" aria-label="Heading link"></a>dotnet CLI</h3>
<pre data-code-wrap="bash"><code class="lang-bash">dotnet new webapi -n MonAPI # Creer un projet API
dotnet new blazor -n MonApp # Creer un projet Blazor
dotnet run # Executer le projet
dotnet watch # Hot reload en developpement
dotnet build -c Release # Compiler en mode Release
dotnet test # Lancer les tests
dotnet publish -c Release -o ./dist # Publier pour le deploiement
dotnet ef migrations add NomMigration # Creer une migration EF
dotnet ef database update # Appliquer les migrations
dotnet tool install -g dotnet-ef # Installer l'outil EF globalement
</code></pre>
<h3><a name="p-87-git-40" class="anchor" href="#p-87-git-40" aria-label="Heading link"></a>Git</h3>
<pre data-code-wrap="bash"><code class="lang-bash">git log --oneline --graph -20 # Historique graphique
git stash / git stash pop # Mettre de cote / restaurer
git rebase main # Rebaser sur main
git cherry-pick <hash> # Appliquer un commit specifique
git bisect start # Trouver un commit fautif
git reflog # Historique de toutes les actions
</code></pre>
<h3><a name="p-87-azure-cli-az-41" class="anchor" href="#p-87-azure-cli-az-41" aria-label="Heading link"></a>Azure CLI (az)</h3>
<pre data-code-wrap="bash"><code class="lang-bash">az login # Se connecter
az group create -n MonRG -l westeurope # Creer un resource group
az webapp create -g MonRG -p MonPlan -n MonApp # Creer une Web App
az webapp deploy -g MonRG -n MonApp --src-path ./dist.zip # Deployer
az acr build --registry MonACR --image monapp:v1 . # Build image
</code></pre>
<h3><a name="p-87-powershell-pwsh-42" class="anchor" href="#p-87-powershell-pwsh-42" aria-label="Heading link"></a>PowerShell (pwsh)</h3>
<pre data-code-wrap="powershell"><code class="lang-powershell">Get-Command -Service # Trouver des commandes
Get-Help Get-Process -Examples # Aide avec exemples
Get-Process | Sort-Object CPU -Desc | Select-Object -First 10 # Top CPU
Measure-Command { script.ps1 } # Mesurer le temps d'execution
Test-Connection google.com -Count 4 # Equivalent de ping
</code></pre>
<hr>
<blockquote>
<p><strong>Liens utiles</strong> : <a href="https://learn.microsoft.com">learn.microsoft.com</a> | <a href="https://github.com/dotnet">github.com/dotnet</a> | <a href="https://devblogs.microsoft.com">devblogs.microsoft.com</a></p>
</blockquote>
<p><em>Pour un accompagnement professionnel : <a href="https://ayinedjimi-consultants.fr">ayinedjimi-consultants.fr</a></em></p>