I have a web app that needs to invoke an executable. Said executable is missing. So in Azure I must:
Jan David Narkiewicz (Developer)
Tuesday, June 24, 2025
Azure: Web App Viewing Deployed Files
Friday, April 25, 2025
Visual Studio: Disabling Add Using Statements on Paste
Of late, I am tending to paste a lot more code into existing C# source files due to AI. Visual Studio 2022 introduced a feature that after code is pasted, Visual Studio will add any missing using statements to the source file. When working with CSV-related code, without my knowledge, Visual Studio adds the following to the top of a source file:
using Microsoft.VisualBasic.FileIO;
I do not want tools such as Visual Studio 2022, Copilot, or ChatGPT to write code without my knowledge or consent.
To disable the automatic addition of using directives after pasting in Visual Studio 2022 or later:
- From the Tools menu, select Options…
- Navigate to Text Editor → C# → Advanced
- Uncheck Add missing using directives on paste
I have disabled this feature multiple times. It seems to re-enable. Proof of Skynet?
Visual Studio: C# Project-Level Global Usings
Visual Studio 2022 and its support for C# 10.0 and .NET 6.0 allow using statements to be placed at the project level (using the syntax global using <namespace>;), stored within the project’s Properties. To access this feature, right-click a project in Solution Explorer, select Properties from the context menu, and then choose the Global Usings tab:
Using the above cleans up individual C# files, which can become pointlessly cluttered, as shown in the following example:
It is possible to have a standalone C# file that serves the same purpose, such as a per-project GlobalUsing.cs:
A dedicated file, such as GlobalUsing.cs, is cleaner than per-source-file using statements. However, setting project-level global usings remains the cleanest approach.
As always, beware of the following, should some malevolent entity disable the feature for your project:
Tuesday, April 1, 2025
SQL Server: T-SQL Adding a CreatedUtc and ModifiedUtc to a Database Table
As a 120 WPM typist (you read that right), ChatGPT or its cousins are a time-saver. I know the drill of adding a column or columns to an existing table. I want the columns to be required, but this means I have to first assign a value to each existing row in the database.
Take adding CreatedUtc/ModifiedUtc to a table (or all tables, long term) in a database. Here is what you tell ChatGPT:
For a SQL Server table write the following T-SQL:
- Use ALTER TABLE to add CreatedUtc and ModifiedUtc columns of type DATETIME2 as nullable
- Assign a DATETIME2 UTC value of January 1, 2025, 00:00:00 to a variable @stockCreatedDateTimeUtc
- Update all existing entries in the table to set CreatedUtc and ModifiedUtc to @stockCreatedDateTimeUtc
- Write an ALTER TABLE script to make CreatedUtc and ModifiedUtc not nullable
And here are the results but ChatGPT missed the required GO under the ALTER TABLE:
GO
Total time: under 60 seconds. Maybe 10 minutes if I typed it out by hand. You still need to know how to code T-SQL and understand SQL Server to use AI correctly.
Wednesday, November 13, 2024
PowerShell: Create a git branch for an issue (type, number and title)
On a project the branches used take the following form where issues are of type Bug, Task, etc:
Example branch names are:
The code to create the branch name and perform a "git checkout -b" to create the branch locally is as follows (script New-Branch.ps1):
The corresponding launch.json is follows:
Git: Merging a branch and Prioritizing Current Branch
In a local git repo, I was working on a branch. I had to merge with main. During the merge I wanted the changes made in my branch to be prioritized over any changes in main. On some projects, I'm just an arrogant sod that way.
This is the git command that merged branch, main, with my current branch and prioritizes the. current branch with the merge:
The result of the following command will be to:
- Ignores all changes from branch, main.
Keeps all the changes from the current branch which means any changes made to the main branch will be discarded.
Thursday, August 1, 2024
Windows 11: Remove Microsoft News Widget
I will not make negative comments in my blog. Here is the command to uninstall the Microsoft News widget on Windows 11: