Edit README.md file in Visual Studio
A good README.md is the front door of any repository. You don't need to leave Visual Studio to write one: you can edit and preview Markdown in the IDE.
1. Add the README to your solution
A README at the repository root is usually not part of any project, so it doesn't show up in Solution Explorer. Add it as a solution item:
- Right-click the solution in Solution Explorer.
- Choose Add › Existing Item… (or New Item… if it doesn't exist yet).
- Select
README.md. It appears under a Solution Items folder.
With SDK-style projects, any README.md inside the project folder is picked up automatically.
2. Edit with live preview
Since Visual Studio 2022 version 17.5, a Markdown editor is built in. Open any .md file and you get:
- A live preview, side by side or top and bottom, which you can switch from the editor toolbar.
- Toolbar buttons for bold, italic, headings, lists, links and code.
- Syntax highlighting for fenced code blocks.
Older versions: on Visual Studio 2019 or earlier 2022 builds, install the free Markdown Editor extension by Mads Kristensen (Extensions › Manage Extensions). It adds the same preview pane.
3. Markdown cheat sheet
| You write | You get |
|---|---|
# Title |
Heading level 1 (## for level 2…) |
**bold** / *italic* |
bold / italic |
- item |
Bullet list |
[text](https://url) |
Link |
 |
Image |
`code` |
Inline code |
```csharp … ``` |
Code block with C# highlighting |
4. A README template to start from
# My.Library
Short description of what it does and why.
## Install
dotnet add package My.Library
## Usage
```csharp
var client = new MyClient(options);
var result = await client.RunAsync();
```
## License
MIT
5. Bonus: ship the README inside your NuGet package
nuget.org shows a package's README on its page. Include it from the .csproj:
<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
Run dotnet pack, and the README is in the package and shows on nuget.org.