Skip to content

Commit 8c2b954

Browse files
Remove unused
1 parent b43cbd9 commit 8c2b954

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

CodeConv/CodeConvProgram.DotNetTool.cs

Lines changed: 0 additions & 6 deletions
This file was deleted.

CodeConv/CodeConvProgram.cs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public partial class CodeConvProgram
5656
[Option("-f|--force", "Wipe the output directory before conversion", CommandOptionType.NoValue)]
5757
public bool Force { get; }
5858

59-
[Option(CoreOptionDefinition, "Force dot net core build if converting only .NET Core projects and seeing pre-conversion compile errors", CommandOptionType.NoValue)]
60-
public bool CoreOnlyProjects { get; }
61-
6259
[Option("-b|--best-effort", "Overrides warnings about compilation issues with input, and attempts a best effort conversion anyway", CommandOptionType.NoValue)]
6360
public bool BestEffort { get; }
6461

@@ -74,12 +71,6 @@ public partial class CodeConvProgram
7471

7572
private async Task<int> ExecuteAsync()
7673
{
77-
// 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
78-
// Instead, if MSBuild 16.0+ is available, start a .NET framework process and let it run with that
79-
if (_runningInNetCore && !CoreOnlyProjects) {
80-
await Console.Error.WriteLineAsync($"Net Framework projects detected. This is not supported after codeconv 9.2.7. Run an older version from github.com/icsharpcode/CodeConverter");
81-
}
82-
8374
try {
8475
Progress<ConversionProgress> progress = new Progress<ConversionProgress>(s => Console.Out.WriteLine(s.ToString()));
8576
await ConvertAsync(progress, CancellationToken.None);
@@ -106,23 +97,6 @@ await Console.Error.WriteLineAsync(Environment.NewLine + ex.Message + Environmen
10697
return 0;
10798
}
10899

109-
private static async Task<int> RunNetFrameworkExeAsync(string latestMsBuildExePath)
110-
{
111-
Console.WriteLine($"Using .NET Framework MSBuild from {latestMsBuildExePath}");
112-
var assemblyDirectoryPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
113-
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
114-
if (string.IsNullOrWhiteSpace(assemblyDirectoryPath)) throw new InvalidOperationException("Could not retrieve executing assembly directory");
115-
var netFrameworkExe = Path.Combine(assemblyDirectoryPath, "..", "..", "NetFramework", "ICSharpCode.CodeConverter.CodeConv.NetFramework.exe");
116-
if (!File.Exists(netFrameworkExe) && Path.GetDirectoryName(assemblyDirectoryPath) is { } assemblyDirectoryParentPath) {
117-
118-
var debugAssemblyDirectoryPath = assemblyDirectoryParentPath.Replace("CommandLine\\CodeConv\\", "CommandLine\\CodeConv.NetFramework\\");
119-
var debugNetFrameworkExe = Path.Combine(debugAssemblyDirectoryPath, "ICSharpCode.CodeConverter.CodeConv.NetFramework.exe");
120-
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.");
121-
}
122-
var exitCode = await ProcessRunner.ConnectConsoleGetExitCodeAsync(netFrameworkExe, args);
123-
return exitCode;
124-
}
125-
126100
private async Task ConvertAsync(IProgress<ConversionProgress> progress, CancellationToken cancellationToken)
127101
{
128102
string finalSolutionPath = Path.IsPathRooted(SolutionPath)
@@ -175,21 +149,4 @@ private bool ShouldIncludeProject(Project project)
175149
var isIncluded = !Include.Any() || Include.Any(regex => Regex.IsMatch(projectFilePath, regex));
176150
return isIncluded && Exclude.All(regex => !Regex.IsMatch(projectFilePath, regex));
177151
}
178-
179-
private static async Task<string?> GetLatestMsBuildExePathAsync()
180-
{
181-
// The second path here is available on github action agents: https://github.com/microsoft/setup-msbuild#how-does-this-work
182-
var pathsToCheck = new[] {@"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe", @"%ProgramData%\chocolatey\bin"}
183-
.Select(Environment.ExpandEnvironmentVariables).ToArray();
184-
var vsWhereExe = pathsToCheck.FirstOrDefault(File.Exists)
185-
?? throw new FileNotFoundException($"Could not find VSWhere in: {string.Join(", ", pathsToCheck.Select(p => $"`{p}`"))}");
186-
var args = new[] { "-latest", "-prerelease", "-products", "*", "-requires", "Microsoft.Component.MSBuild", "-version", "[16.0,]", "-find", @"MSBuild\**\Bin\MSBuild.exe" };
187-
188-
var (exitCode, stdOut, _) = await new ProcessStartInfo(vsWhereExe) {
189-
Arguments = ArgumentEscaper.EscapeAndConcatenate(args)
190-
}.GetOutputAsync();
191-
192-
if (exitCode == 0 && !string.IsNullOrWhiteSpace(stdOut)) return stdOut;
193-
return null;
194-
}
195152
}

0 commit comments

Comments
 (0)