sudo apt update
sudo apt install git
sudo apt install git-lfsHandling Personal vs. Work identities correctly using Git.
We use conditional includes to separate configuration based on the directory path or remote URL.
~/.gitconfig (Global):
[includeIf "hasconfig:remote.*.url:git@github.com:*/**"]
path = ~/.gitservers/.gitconfig-github
[includeIf "hasconfig:remote.*.url:ssh://user@private-repo.com*/**"]
path = ~/.gitservers/.gitconfig-work~/.gitservers/.gitconfig-github:
[user]
name = Damir Lisak
email = public@example.com~/.gitservers/.gitconfig-work:
[user]
name = Damir Lisak
email = work@example.comAutomate key selection for different hosts.
- Generate/Copy Keys: Ensure permissions are strict (
chmod 600). - Add to Agent:
ssh-add ~/.ssh/id_rsa_work - Config File:
# Work Server
Host private-repo.com
HostName private-repo.com
User git
IdentityFile ~/.ssh/id_rsa_work
AddKeysToAgent yes
# GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_github
AddKeysToAgent yes
For native Linux development (Avalonia, Console, Web API):
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0
# Or specific version like 6.0 / 9.0Recommended extensions for .NET development:
- C# Dev Kit (Microsoft)
- Avalonia for VSCode (if doing UI work)
- Docker
- Remote - SSH
If you are experiencing problems with the NuGet V3 API in a Windows VM due to Incus NAT:
References:
Switch Nuget API in Visual Studio Settings from V3 to V2 until this bug is fixed.
Another possible cause is the prioritization of IPv6 over IPv4. This order can be resolved as follows:
sudo vim /etc/gai.conf
Remove hashtag:
precedence ::ffff:0:0/96 100
systemctl restart systemd-networkdReferences:
Normally, you can't compile WPF projects with VS Code because Microsoft doesn't provide the Microsoft.WindowsDesktop.App package for Linux. However, with a few tricks, it's possible to compile the iPlus WPF version and even develop it in VS Code (using Code IntelliSense...). Read Chapter Extra Utilities first.
-
Download SDK for Windows x64 because it contains the Microsoft.WindowsDesktop.App package.
-
Copy the Microsoft.WindowsDesktop.App to the dotnet packs folder of linux:
cp -r ~/".wine/drive_c/Program Files/dotnet/packs/Microsoft.WindowsDesktop.App.Ref" ~/.dotnet/packs/
-
Open Settings in VS Code and search and set this parameter:
- dotnet.server.useOmnisharp = true
- omnisharp.useModernNet = true
- omnisharp.enableMsBuildLoadProjectsOnDemand = true
-
Restart VS Code.
-
Modify your csproj ot Directory.Build.props and add
<EnableWindowsTargeting>true</EnableWindowsTargeting> -
If you encounter error messages (NU3028 and NU3037) during compilation, you will need to copy the nuget packages yourself into the nuget packages folder.
-
For launching iPlus WPF-App you have to add a launch.json and tasks.json into you .vscode directory.
- Install Mono or newer versions from Wine.
sudo apt install ca-certificates gnupg sudo gpg --homedir /tmp --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/mono-official-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF sudo chmod +r /usr/share/keyrings/mono-official-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/mono-official-archive-keyring.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list sudo apt update sudo apt install mono-complete msbuild
- In VS Code settings locate "OmniSharp: Mono Path" and set its value to /usr
- Add a settings.json file to the .vscode folder
{ "dotnet.server.useOmnisharp": true, "omnisharp.useModernNet": false, "omnisharp.loggingLevel": "debug" } - Open Extensions and deactivate .NET MAUI and C# Dev Kit Extension for this workspace
- Restart extensions or reopen VS Code
Solution 3 has the disadvantage that you cannot compile WPF projects. Therefore, an alternative solution is to install VS Code in Wine and also the WPF SDK for framework 4.8. Please read how to install wine and dnspy first.
- Download the Developer Pack and install it in Wine:
WINEPREFIX="$HOME/.wine-yourprefix" wine NDP48-DevPack-ENU.exe - Download VS Code for Windows and install it in Wine:
WINEPREFIX="$HOME/.wine-yourprefix" wine VSCodeSetup-x64-1.108.2.exe - Download Powershell msi installer for Windows and install it in Wine:
WINEPREFIX="$HOME/.wine-yourprefix" wine PowerShell-7.5.4-win-x64.msi - Start VS Code in Wine and install the C# for Visual Studio Code Extension
ms-dotnettools.csharp Version 1.24.4. Not a newer one, because this is the last version where msbuild.exe is shipped with omnisharp! Don't install the C# Dev Kit (It's only for net core projects) and you will get problems with omnisharp because it sets the setting "Use Modern Sharp".
To be on the safe side, you can create a settings.json file to turn it off for your project if you also have net core project where you need the C# Dev Kit.
WINEPREFIX="$HOME/.wine-yourprefix" wine code{ "dotnet.server.useOmnisharp": true, "omnisharp.useModernNet": false, "omnisharp.loggingLevel": "debug" } - Install mono.
WINEPREFIX="$HOME/.wine-dotnet48-64" winetricks mono WINEPREFIX="$HOME/.wine-dotnet48-64" wineboot -k
- To be able to run msbuild with powershell, the path to msbuild.exe must be set and persisted. Open the powershell terminal in VS Code and run:
Reload powershell terminal. This powershell settings are stored in the users profile: /home/damir/{wineprefix}/drive_c/users/{username}/Documents/PowerShell/Microsoft.PowerShell_profile.ps1 You can query it with:
Set-Alias -Name msbuild -Value "C:\users\yourusername\.vscode\extensions\ms-dotnettools.csharp-1.24.4-win32-x64\.omnisharp\1.38.2\.msbuild\Current\Bin\MSBuild.exe" -Force New-Item -ItemType Directory -Force -Path "$Home\Documents\PowerShell" New-Item -ItemType File -Force -Path "$Home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1" Add-Content -Path $PROFILE -Value 'Set-Alias -Name msbuild -Value "C:\users\yourusername\.vscode\extensions\ms-dotnettools.csharp-1.24.4-win32-x64\.omnisharp\1.38.2\.msbuild\Current\Bin\MSBuild.exe" -Force'
If you have problems with cryptic letters in the output while typing then you should append these rows into Microsoft.PowerShell_profile.ps1$PROFILE.CurrentUserCurrentHost# 1. Stop the "disappearing text" bug by disabling the interactive input handler if (Get-Module PSReadLine) { Remove-Module PSReadLine } # 2. Stop the "cryptic letters" by forcing plain text output $PSStyle.OutputRendering = [System.Management.Automation.OutputRendering]::PlainText # 3. Optional: Fix encoding for special characters (slashes, dots, etc.) [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
- If your build your solution e.g. "msbuild iPlusNoTools.sln -m" you may get an version mismatch of the installed assemblies of omnisharp. Therefore check for each error if the version number of the assembly is the same as declared in the MSBuild.exe.config. You find it in the this under this location:
/home/yourusername/.wine-yourprefix/drive_c/users/yourusername/.vscode/extensions/ms-dotnettools.csharp-1.24.4-win32-x64/.omnisharp/1.38.2/.msbuild/Current/Bin/MSBuild.exe.config
Open the MSBuild.exe.config and search for the Asslembly. In Version 1.24.4 are these assemblies which are wrong. This is the fix:To determine which Version ist installed use the exiftool:<dependentAssembly> <assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="5.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Resources.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.1.0" /> </dependentAssembly>
exiftool /home/damir/.wine-yourprefix/drive_c/users/yourusername/.vscode/extensions/ms-dotnettools.csharp-1.24.4-win32-x64/.omnisharp/1.38.2/.msbuild/Current/Bin/System.Resources.Extensions.dll | grep Version
Unfortunately there is no possibility to debug netframework 4.8 WPF Applications directly with VS Code debugger on Wine. In the launch.json settings you have three debugger options:
- "type": "coreclr": This is for NET Core projects. If you start a net48 wpf application, the app will start but the debugger won't attach.
- "type": "clr": This is for net48 projects. This only works on a Windows machine.
- "type": "mono": This is for debugging net48 projects but not for WPF! For normal net48 projects you can download the installer from the mono site and install it:
Then install the ms-vscode.mono-debug extension in VS code. Now your debugger is able to debug. IMPORTANT: You can only debug projects that have a portable pdb format. Therefore change in all your *csproj files the Debug-Type:
WINEPREFIX="$HOME/.wine-dotnet48-64" wine mono-6.12.0.206-x64-0.msi WINEPREFIX="$HOME/.wine-dotnet48-64" wine regedit # Edit HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment\Path and Append C:\Program Files\Mono\bin WINEPREFIX="$HOME/.wine-dotnet48-64" wineboot -r
<DebugType>portable</DebugType>
You only can debug it with dnspy. But you can automate, that you launch the application from VS Code and automatically attach dnspy.
Create a excecutable shell script with name "wine_debug_dnspy.sh":
#!/bin/bash
export WINEPREFIX=$HOME/.wine-dotnet48-64
# $1 might be /home/damir/... or D:\...
INPUT_PATH="$1"
# 1. Normalize paths using winepath to handle mixed slashes (from VS Code)
LINUX_FULL_PATH=$(winepath -u "$INPUT_PATH")
LINUX_EXE_DIR=$(dirname "$LINUX_FULL_PATH")
EXE_PATH=$(winepath -w "$INPUT_PATH")
EXE_NAME=$(basename "$LINUX_FULL_PATH")
# 3. Clear dnSpy session
DNSPY_CONFIG_DIR="$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/dnSpy"
if [ -d "$DNSPY_CONFIG_DIR" ]; then
rm -rf "$DNSPY_CONFIG_DIR"/*
fi
# 4. Find all gip DLLs
DLL_LIST=$(find "$LINUX_EXE_DIR" -maxdepth 1 -name "gip.*.dll" -exec winepath -w {} +)
# 5. Launch
wine "$EXE_PATH" &
sleep 2
DNSPY_BIN="/home/damir/SHARED/Devel/Tools/dnSpy/dnSpy-netframework/dnSpy.exe"
wine "$DNSPY_BIN" -pn "$EXE_NAME" "$EXE_PATH" $DLL_LISTAdd to your launch.json file this section:
{
"name": "DNSPY Launch",
"type": "node-terminal",
"request": "launch",
"command": "${workspaceFolder}/../wine_debug_dnspy.sh \"${workspaceFolder}/bin/Debug/gip.iplus.client.exe\"",
"cwd": "${workspaceFolder}",
}Now you are ready to debug the WPF-Application.