Needed: Very simple extension for running single C# files

Should be easy for someone who knows how to make extensions.
I want to right-click a C# file and select Run. Which basically is:

dotnet run --file path

>Ex: dotnet run --file "D:\GoogleDrive\My Content\My Projects\SLT\Assets\SLT.Assets\Test.cs"

Or is it possible to make it a Command?
I got it working in VS Code; I need it in VS too.

reddit.com
u/SL-Tech — 14 hours ago

Inline suggestions in Viisual Studio - leave stuff alone

I use inline suggestions from GitHub Copilot in Visual Studio, and it works great! Just two very strange things.

It always recommends changing the ICollection<> initializer from my preferred way: [];
To: new List<>();

And yeah, it doesn't like the new extension() {} element and wants to change to the old style using static methods.

Are there any "instructions" I can give?

reddit.com
u/SL-Tech — 1 day ago
▲ 2 r/dotnet

Instruct inline suggestions?

I use inline suggestions from GitHub Copilot in Visual Studio, and it works just great! Just one very strange thing.

It always recommends changing the ICollection<> initializer from my preferred way: [];
To: new List<>();

And yeah, it doesn't like the new extension() {} element and wants to change to the old style of static methods.

>How can I tell it to leave my collection initializers alone?

reddit.com
u/SL-Tech — 1 day ago

Custom snippet targeting Markdown files

Is it possible to target Markdown files in a custom snippet? What should the Code Language be? Thanks!

reddit.com
u/SL-Tech — 23 days ago

Coding setup for an old-school coder. Complete with a drying rack.

The computer is an i7 with an RTX 2070. Bought it used about a year ago. Only 16 GB of RAM, but I've bought 32 GB; I'm just waiting to install it. Mainly used for Visual Studio and other developer tools.

u/SL-Tech — 1 month ago

PowerShell 7 - replace

Just wondering, when installing, why doesn't PowerShell 7 replace the installed version (Windows)?

reddit.com
u/SL-Tech — 1 month ago
▲ 12 r/csharp

Entity Framework Core Migrations - Multiple DB contexts.

So, I have two DB contexts. I want to place migrations in separate folders, so I run:

dotnet-ef migrations add Init420 --context AssetsDevDbContext --output-dir Migrations/AssetsDevDb

It creates files and snapshots in Migrations/AssetsDevDb, so all is good. But when I run:

dotnet-ef database update --context AssetsDevDbContext

I get:

>No migrations were found in assembly 'SLT.Assets'. A migration needs to be added before the database can be updated.

According to the docs, EF Core should remember the folder. But right now it doesn't work.

Any thoughts? Thanks!

reddit.com
u/SL-Tech — 2 months ago

Solution diagram

I'm looking for an extension to make a type and inheritance diagram from a project. If not an extension, are there any software that can do it?

reddit.com
u/SL-Tech — 3 months ago

Why doesn't my script close the active window?

When I run the script, the window doesn't close, even though exit is the last line. What am I missing? Thanks!

Script:

$profiles = Get-ChildItem -Path . -Recurse -Filter *.pubxml | Where-Object { $_.FullName -match "PublishProfiles" }


if (-not $profiles) {
    Write-Host "No publish profiles found."
    exit 1
}


foreach ($profile in $profiles) {
    $project = Get-ChildItem -Path $profile.Directory.Parent.Parent.FullName -Filter *.csproj | Select-Object -First 1
    
    if (-not $project) {
        Write-Warning "No project file found for profile: $($profile.FullName)"
        continue
    }


    $profileName = [System.IO.Path]::GetFileNameWithoutExtension($profile.Name)
    Write-Host "Publishing $($project.Name) using profile $profileName ..."
    dotnet publish $project.FullName -c Release /p:PublishProfile=$profileName
}


exit 1$profiles = Get-ChildItem -Path . -Recurse -Filter *.pubxml | Where-Object { $_.FullName -match "PublishProfiles" }


if (-not $profiles) {
    Write-Host "No publish profiles found."
    exit 1
}


foreach ($profile in $profiles) {
    $project = Get-ChildItem -Path $profile.Directory.Parent.Parent.FullName -Filter *.csproj | Select-Object -First 1
    
    if (-not $project) {
        Write-Warning "No project file found for profile: $($profile.FullName)"
        continue
    }


    $profileName = [System.IO.Path]::GetFileNameWithoutExtension($profile.Name)
    Write-Host "Publishing $($project.Name) using profile $profileName ..."
    dotnet publish $project.FullName -c Release /p:PublishProfile=$profileName
}


exit 1
reddit.com
u/SL-Tech — 3 months ago
▲ 1 r/csharp

Path Matcher - tiny tool for listing glob matches

I needed to provide Copilot with paths to exclude from generating tests.
In this app, you provide glob patterns that match against a path.

You can configure how the list of files is formatted, as well as a few other features. Not very advanced, but it does the job.

Hope you like it.

https://github.com/SteinLundbeckTech/SLT.Tools.PathMatcher

u/SL-Tech — 3 months ago

I find myself being very polite, responding with "yes please", "thanks!", "Great! continue with next batch", "superb". Sometimes it saves me from having to edit much code, so a little thanks is natural.

reddit.com
u/SL-Tech — 4 months ago

Everything worked great, then suddenly I got;

>[Conversations Information] [Conversations] Registry is disable due to command failing to run: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'odr.exe' with working directory 'C:\Program Files\Microsoft Visual Studio\18\Community\Common7\ServiceHub\Hosts\ServiceHub.Host.Extensibility.amd64\net10.0-windows10.0.19041.0'. The system cannot find the file specified. @@@SOURCE UNKNOWN @@@EVENT ERROR

Is this a known issue?

reddit.com
u/SL-Tech — 4 months ago

When starting VS (2026 Community), I get:

>[CopilotFunctionRegistry Warning] Could not retrieve function provider for {Name=Microsoft.VisualStudio.Copilot.Debugging.DebuggerAgent Version=0.3} to subscribe. @@@SOURCE UNKNOWN @@@EVENT WARNING

It just appeared suddenly. Copilot doesn't seem to have any issues debugging.

reddit.com
u/SL-Tech — 4 months ago