Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
OsirisTerje committed Sep 18, 2024
1 parent 8d908fb commit fd19125
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 51 deletions.
13 changes: 8 additions & 5 deletions DIagnosticsTests/DiagnosticsTests.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IFix\IFix.csproj" />
Expand Down
13 changes: 8 additions & 5 deletions GitIgnoreTests/GitIgnoreTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyTitle>GitIgnoreTests</AssemblyTitle>
<Product>GitIgnoreTests</Product>
<Copyright>Copyright © 2014 Terje Sandstrom</Copyright>
Expand Down Expand Up @@ -37,9 +37,12 @@
<ProjectReference Include="..\IntegrationTest\IntegrationTest.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion IFix/DeleteMefCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace IFix
{
public class DeleteMefCache
{
private readonly List<Cache> caches=new List<Cache>();
private readonly List<Cache> caches=new();

public MefCacheCommand MefCacheCommand { get; private set; }

Expand Down
16 changes: 9 additions & 7 deletions IFix/IFix.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyTitle>IFix</AssemblyTitle>
<Product>IFix</Product>
<PackageId>Hermit.IFix</PackageId>
<Copyright>Copyright Terje Sandstrom 2014-2021</Copyright>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<Version>3.0.0-beta.1</Version>
<Copyright>Copyright Terje Sandstrom 2014-2023</Copyright>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
<Version>4.0.0-beta.1</Version>
<OutputPath>bin\$(Configuration)\</OutputPath>
<PackAsTool>true</PackAsTool>
<ToolCommandName>IFix</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Terje Sandstrom</Authors>
<Description>
IFix is a dotnet tool for fixing different issues with Visual Studio, git, testing, solutions and more
Install it using: dotnet tool install --global Hermit.IFix
and run it doing: IFix --help , which will show the relevant options.
(To install the beta, use --version 3.0.0-beta.1 or whatever beta number there is)
(To install the beta, use --version 4.0.0-beta.1 or whatever beta number there is)
</Description>
<PackageProjectUrl>https://github.com/OsirisTerje/Ifix</PackageProjectUrl>
<RepositoryUrl>https://github.com/OsirisTerje/Ifix</RepositoryUrl>
Expand All @@ -29,9 +30,10 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include=".gitattributes" />
<None Include="icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions IFix/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public class GoToBlog : Options
{
private const string UrlIFix = @"https://visualstudiogallery.msdn.microsoft.com/b8ba97b0-bb89-4c21-a1e2-53ef335fd9cb";

private const string Urlgitignore = @"http://hermit.no/fixing-up-visual-studio-rsquo-s-gitignore-using-ifix/";
private const string Urlgitignore = @"https://hermit.no/fixing-up-visual-studio-rsquo-s-gitignore-using-ifix/";

private const string UrlNugetrestore = @"http://hermit.no/converting-projects-to-use-automatic-nuget-restore-using-ifix/";
private const string UrlNugetrestore = @"https://hermit.no/converting-projects-to-use-automatic-nuget-restore-using-ifix/";

private const string UrlCa0053 = @"http://hermit.no/how-to-fix-the-ca0053-error-in-code-analysis-in-visual-studio-2012/";
private const string UrlCa0053 = @"https://hermit.no/how-to-fix-the-ca0053-error-in-code-analysis-in-visual-studio-2012/";

private const string UrlMefcache = @"http://hermit.no/how-to-fix-visual-studio-loading-errors-using-ifix/";
private const string UrlMefcache = @"https://hermit.no/how-to-fix-visual-studio-loading-errors-using-ifix/";

private const string UrlCreateSln = @"http://hermit.no/ifix-create-solution-skeleton-file/";
private const string UrlCreateSln = @"https://hermit.no/ifix-create-solution-skeleton-file/";
public override int Execute()
{
string url = UrlIFix;
Expand Down
4 changes: 2 additions & 2 deletions IFix/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void HandleErrors(IEnumerable<Error> errors)
{
Console.WriteLine(error);
}
System.Environment.Exit(1);
Environment.Exit(1);
}

public static string GetUsage()
Expand All @@ -67,7 +67,7 @@ public static string GetUsage()
usage.AppendLine(" ca0053");
usage.AppendLine(" info");
usage.AppendLine("For more instructions and information run 'IFix info', or for specific commands 'IFix <command> -?' , or 'IFix info -? ");
usage.AppendLine("(c) Terje Sandstrom (http://hermit.no) , 2015-2021");
usage.AppendLine("(c) Terje Sandstrom (https://hermit.no) , 2015-2024");

return usage.ToString();
}
Expand Down
17 changes: 16 additions & 1 deletion IFix/Runsettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;

namespace IFix
{
Expand All @@ -28,12 +30,25 @@ private void RetrieveRunSettings()

public void DownloadRunsettings(string path)
{
using (var client = new WebClient())
using (var client = new HttpClient())
{
client.DownloadFile("https://raw.githubusercontent.com/OsirisTerje/RunSettings/master/AllTemplate/AllRunSettings.runsettings",
path);
}
}

}

public static class HttpClientExtensions
{
public static async Task DownloadFile(this HttpClient client, string requestUri, string filename)
{
using var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
await using Stream contentStream = client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead)
.Result.Content.ReadAsStreamAsync().Result,
stream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None,
8192, true);
await contentStream.CopyToAsync(stream);
}
}
}
14 changes: 7 additions & 7 deletions IFix/gitignore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ public IReadOnlyCollection<string> AddOnlyMissingInfo(IReadOnlyCollection<string
outlines.Add(line);
var patterns = new List<Tuple<string, bool>>
{
new Tuple<string, bool>(nuGetStart,true),
new Tuple<string, bool>(nuGetPkg,false),
new Tuple<string, bool>(nuGetPackageFull,false),
new Tuple<string, bool>(nuGetPackage194,false),
new Tuple<string, bool>(nuGetReincludeBuild,false),
new Tuple<string, bool>(nuGetReincludeBuild2,false)
new(nuGetStart,true),
new(nuGetPkg,false),
new(nuGetPackageFull,false),
new(nuGetPackage194,false),
new(nuGetReincludeBuild,false),
new(nuGetReincludeBuild2,false)
};
string lastpattern = "";
foreach (var pattern in patterns)
Expand Down Expand Up @@ -340,7 +340,7 @@ public void DownloadGitIgnore(string path)
{
using (var client = new WebClient())
{
client.DownloadFile("https://github.com/github/gitignore/raw/master/VisualStudio.gitignore",
client.DownloadFile("https://raw.githubusercontent.com/github/gitignore/main/VisualStudio.gitignore",
path);
}
}
Expand Down
Binary file added IFix/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 9 additions & 6 deletions IFixTests/IFixTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
Expand All @@ -23,10 +23,13 @@
<ProjectReference Include="..\IntegrationTest\IntegrationTest.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
</Project>
13 changes: 8 additions & 5 deletions IntegrationTest/IntegrationTest.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyTitle>IntegrationTest</AssemblyTitle>
<Product>IntegrationTest</Product>
<Copyright>Copyright © 2014 Terje Sandstrom</Copyright>
Expand All @@ -20,9 +20,12 @@
<ProjectReference Include="..\IFix\IFix.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions IntegrationTest/VerifyProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void VerifyCopyingTargetPathsToConfig()
var sut = new RemoveOldNugetRestore(Command);
var configlinesBefore = File.ReadAllLines(path + "/.nuget/nuget.config");
var outlines = sut.CheckAndCopyNugetPaths(file);
Assert.IsNotNull(outlines,"Didnt find anything");
Assert.That(outlines,Is.Not.Null,"Didnt find anything");
Assert.That(outlines.Lines.Count(),Is.EqualTo(configlinesBefore.Count()+4), "Number of new lines incorrect");

}
Expand All @@ -116,7 +116,7 @@ public void VerifyNotCopyingTargetPathsToConfigWhenOnlyComments()
var sut = new RemoveOldNugetRestore(Command);
var configlinesBefore = File.ReadAllLines(path + "/.nuget/nuget.config");
var outlines = sut.CheckAndCopyNugetPaths(file);
Assert.IsNull(outlines);
Assert.That(outlines,Is.Null);
}


Expand Down
13 changes: 8 additions & 5 deletions RestoreTests/RestoreTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<AssemblyTitle>RestoreTests</AssemblyTitle>
<Product>RestoreTests</Product>
<Copyright>Copyright © 2014</Copyright>
Expand All @@ -20,9 +20,12 @@
<ProjectReference Include="..\IFix\IFix.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
</Project>
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fd19125

Please sign in to comment.