Skip to content

Instantly share code, notes, and snippets.

View madskristensen's full-sized avatar

Mads Kristensen madskristensen

View GitHub Profile
@madskristensen
madskristensen / extensions.vsext
Created June 25, 2021 21:58
My VS2022 extensions
{
"id": "017794d6-b8b4-48ab-88a5-eb696ac07322",
"name": "My Visual Studio extensions",
"description": "A collection of my Visual Studio extensions",
"version": "1.0",
"extensions": [
{
"name": "Add New File",
"vsixId": "2E78AA18-E864-4FBB-B8C8-6186FC865DB3"
},
@madskristensen
madskristensen / RemoveBadgeInVS.ps1
Last active June 25, 2021 15:50
Remove Preview badge in VS
function RemoveBadge {
param ($path)
Write-Host "Looking for PreviewBadge.pkgdef in $path"
$file = Get-ChildItem -Path $path -Include *previewbadge.pkgdef -Recurse
if ($file){
Remove-Item $file
Write-Host "PreviewBadge.pkgdef deleted"
@madskristensen
madskristensen / tools.md
Last active May 3, 2018 20:03
Extensibility tools
@madskristensen
madskristensen / VSIX-Checklist.md
Last active August 6, 2023 13:07
VS extension checklist

Visual Studio Extensibility Checklist

Here is a list of things to make sure to remember before publishing your Visual Studio extension.

Adhere to threading rules

Add the Microsoft.VisualStudio.SDK.Analyzers NuGet package to your VSIX project, which will help you discover and fix common violations of best practices regarding threading.

Add high-quality icon

All extensions should have an icon associated with it. Make sure the icon is a high-quality .png file with the size 90x90 pixels in 96 DPI or more. After adding the icon to your VSIX project, register it in the .vsixmanifest file as both the Icon and Preview image.

Name and description

@madskristensen
madskristensen / vs-2017-api-samples.md
Last active April 5, 2018 11:25
Links to samples of how to use various APIs in the Visual Studio SDK
@madskristensen
madskristensen / _Layout.cshtml
Last active September 17, 2023 06:57
Social sharing buttons for ASP.NET Core
<!-- Render the partial -->
@{await Html.RenderPartialAsync("_SocialSharing", ViewData["Title"]);}
@madskristensen
madskristensen / ETagMiddleware.cs
Last active March 18, 2024 15:11
ASP.NET Core ETAg middleware
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
public class ETagMiddleware
{
@madskristensen
madskristensen / SetEditorSettings.cs
Created August 22, 2016 20:47
How to set basic settings to any language in VS
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
namespace YamlSpacesFix
{
[Export(typeof(IWpfTextViewCreationListener))]
[ContentType(ContentType)]
[TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]
public class YamlCreationListener : IWpfTextViewCreationListener
@madskristensen
madskristensen / VSIX UIContext
Last active January 15, 2021 00:58
Shows how to add custom UIContexts
On the package
[ProvideAutoLoad(UIContexts.LoadContext)]
[ProvideUIContextRule(UIContexts.LoadContext,
"RightFileTypeOpen",
"(CSharpFileOpen | VBFileOpen)",
new[] { "CSharpFileOpen", "VBFileOpen" },
new[] { "ActiveEditorContentType:CSharp", "ActiveEditorContentType:Basic" })]
In the VSCT