Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d31e02c
git insists on commiting this formatting change
GrahamTheCoder Nov 15, 2025
26324ca
Default vscode setup
GrahamTheCoder Nov 15, 2025
3a207d2
Use enumerable method, not array method
GrahamTheCoder Nov 15, 2025
33c66c8
Remove duplicated
GrahamTheCoder Nov 15, 2025
669966b
Update ConsoleApp4.vbproj to target .NET 10.0
GrahamTheCoder Nov 15, 2025
462d5e4
Project says netcore - stop it tageting netframework
GrahamTheCoder Nov 15, 2025
132dccd
Don't force accessibility modifiers on interfaces
GrahamTheCoder Nov 15, 2025
765a3ea
Upgrade, and use type that becomes preferred in later versions
GrahamTheCoder Nov 15, 2025
7075a86
Remove NetFramework project from sln (can tidy up fully later)
GrahamTheCoder Nov 15, 2025
68cf7dd
Enable tests
GrahamTheCoder Nov 15, 2025
0aca918
Fix compile issues
GrahamTheCoder Nov 15, 2025
864f150
Optional cancellation
GrahamTheCoder Nov 15, 2025
30a8eea
Move to new library to allow dotnet10 compatibility (it has a breakin…
GrahamTheCoder Nov 15, 2025
b280e11
Use new overload - the extra rename options can all be left as defaul…
GrahamTheCoder Nov 15, 2025
cc61579
Fixups for API changes
GrahamTheCoder Nov 15, 2025
614d868
Upgrade versions SPIKE: Ignore warnings to get compiling so I can test
GrahamTheCoder Nov 15, 2025
3569e02
Remove dependencies including build locator - theoretically this is a…
GrahamTheCoder Nov 15, 2025
dbeef5f
Add new project, remove old
GrahamTheCoder Nov 15, 2025
e588686
Paste across files and tweak to try to get compiling as before
GrahamTheCoder Nov 15, 2025
ce78a88
Totally redo this converter by getting AI to merge in bits of a separ…
GrahamTheCoder Nov 15, 2025
4c94be2
Reintegrate existing logic
GrahamTheCoder Nov 15, 2025
b113149
Remove superfluous - todo check if there were any extra failure types…
GrahamTheCoder Nov 15, 2025
3966664
Get compilable
GrahamTheCoder Nov 15, 2025
a5c311d
Prepare for .NET 10 upgrade
GrahamTheCoder Nov 15, 2025
4c91085
Store final changes for step 'Validate that a .NET 10.0 SDK required …
GrahamTheCoder Nov 15, 2025
0ea3757
Modernize CSharpConsoleApp.csproj to SDK-style format
GrahamTheCoder Nov 15, 2025
38fc8f8
Remove unused references from CSharpConsoleApp.csproj
GrahamTheCoder Nov 15, 2025
43f4995
Store final changes for step 'Upgrade ConsoleApp2/CSharpConsoleApp.cs…
GrahamTheCoder Nov 15, 2025
72aac81
Move these test projs to dot net 10 and net standard
GrahamTheCoder Nov 15, 2025
c28f81d
Totally overwrite previous output of these tests
GrahamTheCoder Nov 15, 2025
fa6ba19
Try to add references to useful things
GrahamTheCoder Nov 15, 2025
6571042
Remove old built in api - I think we always use the azure function now
GrahamTheCoder Nov 16, 2025
14d93eb
Get references working the same as before in tests at least
GrahamTheCoder Nov 16, 2025
80369d7
Accept changes which seem fine and likely just caused by evolving lib…
GrahamTheCoder Nov 16, 2025
47f0b1f
Make results closer match for existing
GrahamTheCoder Nov 16, 2025
4a6e2ff
These don't matter much - it's hard to reference webui nowadays
GrahamTheCoder Nov 16, 2025
9c19a67
Remove accidental copying of default value for these
GrahamTheCoder Nov 16, 2025
ebff467
Fall back on handling private or unknown cs symbols based on their sy…
GrahamTheCoder Nov 16, 2025
f4b2f84
These changes seem ok
GrahamTheCoder Nov 16, 2025
907a497
Take a best effort match. ExtractBestMatch is a bit of a misnomer - i…
GrahamTheCoder Nov 16, 2025
d4c6bd8
Remove old net framework version
GrahamTheCoder Nov 16, 2025
d2d023f
When there's a single symbol, it now seems to not be available in can…
GrahamTheCoder Feb 5, 2026
c40def4
Extra overloads make this test input ambiguous. Force span
GrahamTheCoder Feb 5, 2026
c25dc44
Use buildprops as override
GrahamTheCoder Feb 5, 2026
26ace3d
Use existing process runner
GrahamTheCoder Feb 5, 2026
99d7035
Consolidate
GrahamTheCoder Feb 5, 2026
ebc32a9
Simplify directory layout and upgrade vulnerable dependency in codeconv
GrahamTheCoder Feb 6, 2026
9a71c5a
We don't want to prune assemblies (NU1510). And for now the tests pas…
GrahamTheCoder Feb 6, 2026
8567efc
Remove old projects from slnf
GrahamTheCoder Feb 6, 2026
7302941
Major version bump since we're dropping support for net framework
GrahamTheCoder Feb 6, 2026
b43cbd9
Build against net 10
GrahamTheCoder Feb 6, 2026
8c2b954
Remove unused
GrahamTheCoder Feb 6, 2026
2fb5390
Bump Microsoft.Bcl.AsyncInterfaces
GrahamTheCoder Feb 6, 2026
5acf6fc
Re-add reference
GrahamTheCoder Feb 6, 2026
11b6408
Add more solution items
GrahamTheCoder Feb 6, 2026
cc3bdbf
Update readme - technically 17.8 probably still works but I haven't t…
GrahamTheCoder Feb 6, 2026
1839975
Specify type to prevent ambiguity
GrahamTheCoder Feb 6, 2026
3f086c5
Register provider now required
GrahamTheCoder Feb 6, 2026
8a792eb
Include async interfaces in vsix (needed for vs2026 at least)
GrahamTheCoder Feb 6, 2026
b18def1
dotnet sln migrate
GrahamTheCoder Feb 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ dotnet_diagnostic.RCS1124.severity = none
dotnet_diagnostic.RCS1077.severity = none

# IDE0040: Add accessibility modifiers
dotnet_style_require_accessibility_modifiers = always:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning

# IDE0048: Add parentheses for clarity
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
Expand Down
34 changes: 34 additions & 0 deletions .github/upgrades/dotnet-upgrade-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# .NET 10 Upgrade Plan

## Execution Steps

Execute steps below sequentially one by one in the order they are listed.

1. Validate that a .NET 10.0 SDK required for this upgrade is installed on the machine and if not, help to get it installed.
2. Ensure that the SDK version specified in global.json files is compatible with the .NET 10.0 upgrade.
3. Upgrade CSharpNetStandardLib/CSharpNetStandardLib.csproj
4. Upgrade ConsoleApp2/CSharpConsoleApp.csproj
5. Upgrade ConsoleApp1/VisualBasicConsoleApp.vbproj

## Settings

### Project upgrade details

#### CSharpNetStandardLib/CSharpNetStandardLib.csproj modifications

Project properties changes:
- Target framework should be changed from `netstandard2.0` to `net10.0`

#### ConsoleApp2/CSharpConsoleApp.csproj modifications

Project file needs to be converted to SDK-style format.

Project properties changes:
- Target framework should be changed from `.NETFramework,Version=v4.8` to `net10.0`

#### ConsoleApp1/VisualBasicConsoleApp.vbproj modifications

Project file needs to be converted to SDK-style format.

Project properties changes:
- Target framework should be changed from `.NETFramework,Version=v4.8` to `net10.0`
4 changes: 2 additions & 2 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

env:
BuildVersion: '9.2.7'
BuildVersion: '10.0.0'

jobs:
build:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup .NET for main build
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
Expand Down
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Web/bin/Debug/ICSharpCode.CodeConverter.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/Web",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dotnet.preferCSharpExtension": true,
"dotnet.defaultSolution": "CodeConverter.sln",
"vscode-as-git-mergetool.settingsAssistantOnStartup": false
}
41 changes: 41 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/CodeConverter.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/CodeConverter.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/CodeConverter.sln"
],
"problemMatcher": "$msCompile"
}
]
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Vsix


### VB -> C#


### C# -> VB


## [10.0.0] - 2026-02-06

* Support for net framework dropped. Please use an older version if you are converting projects that still use it.
* dotnet 10 required to run codeconv command line tool
* Improvements to codeconv tool to support converting newer dotnet versions

### Vsix


### VB -> C#

* Xor operator overloads now converted [#1182](htts://github.com/icsharpcode/CodeConverter/issues/1182)
Expand All @@ -17,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [9.2.7] - 2025-02-15

This is the last version that supports net framework.

### Vsix

Expand Down
28 changes: 8 additions & 20 deletions CommandLine/CodeConv/CodeConv.csproj → CodeConv/CodeConv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPackable>true</IsPackable>
Expand All @@ -11,7 +11,7 @@
<RootNamespace>ICSharpCode.CodeConverter.CodeConv</RootNamespace>
<ToolCommandName>codeconv</ToolCommandName>
<Description>Bidirectional code converter for VB and C#</Description>
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
<PackageReadmeFile>PackageReadme.md</PackageReadmeFile>
<PackageProjectUrl>https://github.com/icsharpcode/CodeConverter/</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>CodeConvNuGetPackageIcon.png</PackageIcon>
Expand All @@ -27,34 +27,22 @@

<ItemGroup>
<None Include="CodeConvNuGetPackageIcon.png" Pack="true" PackagePath="" />
<None Include="$(SolutionDir)CommandLine\CodeConv.NetFramework\bin\$(Configuration)\**" LinkBase="..\NetFramework" PackagePath="tools\NetFramework" Pack="true" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.4.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.1.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.1.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.2" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.8.43" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="NuGet.Build.Tasks" Version="6.11.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />

<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\CodeConverter\CodeConverter.csproj" />
<ProjectReference Include="..\CodeConverter\CodeConverter.csproj" />
</ItemGroup>

<Import Project="..\CodeConv.Shared\CodeConv.Shared.projitems" Label="Shared" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public partial class CodeConvProgram
[Option("-f|--force", "Wipe the output directory before conversion", CommandOptionType.NoValue)]
public bool Force { get; }

[Option(CoreOptionDefinition, "Force dot net core build if converting only .NET Core projects and seeing pre-conversion compile errors", CommandOptionType.NoValue)]
public bool CoreOnlyProjects { get; }

[Option("-b|--best-effort", "Overrides warnings about compilation issues with input, and attempts a best effort conversion anyway", CommandOptionType.NoValue)]
public bool BestEffort { get; }

Expand All @@ -74,16 +71,6 @@ public partial class CodeConvProgram

private async Task<int> ExecuteAsync()
{
// Ideally we'd be able to use MSBuildLocator.QueryVisualStudioInstances(DiscoveryType.VisualStudioSetup) from .NET core, but it will never be supported: https://github.com/microsoft/MSBuildLocator/issues/61
// Instead, if MSBuild 16.0+ is available, start a .NET framework process and let it run with that
if (_runningInNetCore && !CoreOnlyProjects) {
if (await GetLatestMsBuildExePathAsync() is { } latestMsBuildExePath) {
return await RunNetFrameworkExeAsync(latestMsBuildExePath);
} else {
Console.WriteLine($"Using dot net SDK MSBuild which only works for dot net core projects.");
}
}

try {
Progress<ConversionProgress> progress = new Progress<ConversionProgress>(s => Console.Out.WriteLine(s.ToString()));
await ConvertAsync(progress, CancellationToken.None);
Expand All @@ -110,23 +97,6 @@ await Console.Error.WriteLineAsync(Environment.NewLine + ex.Message + Environmen
return 0;
}

private static async Task<int> RunNetFrameworkExeAsync(string latestMsBuildExePath)
{
Console.WriteLine($"Using .NET Framework MSBuild from {latestMsBuildExePath}");
var assemblyDirectoryPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
if (string.IsNullOrWhiteSpace(assemblyDirectoryPath)) throw new InvalidOperationException("Could not retrieve executing assembly directory");
var netFrameworkExe = Path.Combine(assemblyDirectoryPath, "..", "..", "NetFramework", "ICSharpCode.CodeConverter.CodeConv.NetFramework.exe");
if (!File.Exists(netFrameworkExe) && Path.GetDirectoryName(assemblyDirectoryPath) is { } assemblyDirectoryParentPath) {

var debugAssemblyDirectoryPath = assemblyDirectoryParentPath.Replace("CommandLine\\CodeConv\\", "CommandLine\\CodeConv.NetFramework\\");
var debugNetFrameworkExe = Path.Combine(debugAssemblyDirectoryPath, "ICSharpCode.CodeConverter.CodeConv.NetFramework.exe");
netFrameworkExe = File.Exists(debugNetFrameworkExe) ? debugNetFrameworkExe : throw new FileNotFoundException($"Cannot find net framework exe at `{netFrameworkExe}`. Using the --core-only flag to get work around this.");
}
var exitCode = await ProcessRunner.ConnectConsoleGetExitCodeAsync(netFrameworkExe, args);
return exitCode;
}

private async Task ConvertAsync(IProgress<ConversionProgress> progress, CancellationToken cancellationToken)
{
string finalSolutionPath = Path.IsPathRooted(SolutionPath)
Expand All @@ -150,7 +120,7 @@ private async Task ConvertAsync(IProgress<ConversionProgress> progress, Cancella

var properties = ParsedProperties();
var joinableTaskFactory = new JoinableTaskFactory(new JoinableTaskContext());
var msbuildWorkspaceConverter = new MSBuildWorkspaceConverter(finalSolutionPath, CoreOnlyProjects, joinableTaskFactory, BestEffort, properties);
var msbuildWorkspaceConverter = new MsBuildWorkspaceConverter(joinableTaskFactory, finalSolutionPath, BestEffort, properties);

var converterResultsEnumerable = msbuildWorkspaceConverter.ConvertProjectsWhereAsync(ShouldIncludeProject, TargetLanguage, progress, cancellationToken);
await ConversionResultWriter.WriteConvertedAsync(converterResultsEnumerable, finalSolutionPath, outputDirectory, Force, true, strProgress, cancellationToken);
Expand Down Expand Up @@ -179,21 +149,4 @@ private bool ShouldIncludeProject(Project project)
var isIncluded = !Include.Any() || Include.Any(regex => Regex.IsMatch(projectFilePath, regex));
return isIncluded && Exclude.All(regex => !Regex.IsMatch(projectFilePath, regex));
}

private static async Task<string?> GetLatestMsBuildExePathAsync()
{
// The second path here is available on github action agents: https://github.com/microsoft/setup-msbuild#how-does-this-work
var pathsToCheck = new[] {@"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe", @"%ProgramData%\chocolatey\bin"}
.Select(Environment.ExpandEnvironmentVariables).ToArray();
var vsWhereExe = pathsToCheck.FirstOrDefault(File.Exists)
?? throw new FileNotFoundException($"Could not find VSWhere in: {string.Join(", ", pathsToCheck.Select(p => $"`{p}`"))}");
var args = new[] { "-latest", "-prerelease", "-products", "*", "-requires", "Microsoft.Component.MSBuild", "-version", "[16.0,]", "-find", @"MSBuild\**\Bin\MSBuild.exe" };

var (exitCode, stdOut, _) = await new ProcessStartInfo(vsWhereExe) {
Arguments = ArgumentEscaper.EscapeAndConcatenate(args)
}.GetOutputAsync();

if (exitCode == 0 && !string.IsNullOrWhiteSpace(stdOut)) return stdOut;
return null;
}
}
Loading
Loading