-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for converting all projects in a solution, and converti…
…ng multiple selected projects. See #2
- Loading branch information
Showing
14 changed files
with
362 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/PackageReferenceVersionToAttributeExtension/Commands/MultipleProjectNodesCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// <copyright file="MultipleProjectNodesCommand.cs" company="Rami Abughazaleh"> | ||
// Copyright (c) Rami Abughazaleh. All rights reserved. | ||
// </copyright> | ||
|
||
namespace PackageReferenceVersionToAttributeExtension | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Community.VisualStudio.Toolkit; | ||
using Community.VisualStudio.Toolkit.DependencyInjection; | ||
using Community.VisualStudio.Toolkit.DependencyInjection.Core; | ||
using EnvDTE; | ||
using Microsoft.VisualStudio.Shell; | ||
using PackageReferenceVersionToAttributeExtension.Services; | ||
|
||
/// <summary> | ||
/// Project node command. | ||
/// </summary> | ||
[Command( | ||
PackageGuids.guidPackageReferenceVersionToAttributeExtensionCmdSetString, | ||
PackageIds.PackageReferenceVersionToAttributeMultipleProjectNodesCommand)] | ||
internal sealed class MultipleProjectNodesCommand( | ||
DIToolkitPackage package, | ||
LoggingService loggingService, | ||
ProjectService projectService, | ||
FileSystemService fileSystemService) | ||
: BaseDICommand(package) | ||
{ | ||
private readonly BaseCommand baseCommand = new(loggingService, projectService, fileSystemService); | ||
|
||
/// <inheritdoc/> | ||
protected override void BeforeQueryStatus(EventArgs e) | ||
{ | ||
this.Package.JoinableTaskFactory.Run(async () => | ||
{ | ||
// Check the current selection in Solution Explorer | ||
var selectedProjects = await this.baseCommand.GetSelectedProjectsAsync(); | ||
|
||
// Enable command if there are any C# projects selected | ||
this.Command.Enabled = selectedProjects.Any(p => p.IsCapabilityMatch("CSharp")); | ||
}); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) | ||
{ | ||
await this.baseCommand.ConvertPackageReferenceVersionElementsToAttributesAsync(); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/PackageReferenceVersionToAttributeExtension/Commands/ProjectNodeCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <copyright file="ProjectNodeCommand.cs" company="Rami Abughazaleh"> | ||
// Copyright (c) Rami Abughazaleh. All rights reserved. | ||
// </copyright> | ||
|
||
namespace PackageReferenceVersionToAttributeExtension | ||
{ | ||
using System.Threading.Tasks; | ||
using Community.VisualStudio.Toolkit; | ||
using Community.VisualStudio.Toolkit.DependencyInjection; | ||
using Community.VisualStudio.Toolkit.DependencyInjection.Core; | ||
using EnvDTE; | ||
using Microsoft.VisualStudio.Shell; | ||
using PackageReferenceVersionToAttributeExtension.Services; | ||
|
||
/// <summary> | ||
/// Project node command. | ||
/// </summary> | ||
[Command( | ||
PackageGuids.guidPackageReferenceVersionToAttributeExtensionCmdSetString, | ||
PackageIds.PackageReferenceVersionToAttributeProjectNodeCommand)] | ||
internal sealed class ProjectNodeCommand( | ||
DIToolkitPackage package, | ||
LoggingService loggingService, | ||
ProjectService projectService, | ||
FileSystemService fileSystemService) | ||
: BaseDICommand(package) | ||
{ | ||
private readonly BaseCommand baseCommand = new(loggingService, projectService, fileSystemService); | ||
|
||
/// <inheritdoc/> | ||
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) | ||
{ | ||
await this.baseCommand.ConvertPackageReferenceVersionElementsToAttributesAsync(); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/PackageReferenceVersionToAttributeExtension/Commands/SolutionNodeCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <copyright file="SolutionNodeCommand.cs" company="Rami Abughazaleh"> | ||
// Copyright (c) Rami Abughazaleh. All rights reserved. | ||
// </copyright> | ||
|
||
namespace PackageReferenceVersionToAttributeExtension | ||
{ | ||
using System.Threading.Tasks; | ||
using Community.VisualStudio.Toolkit; | ||
using Community.VisualStudio.Toolkit.DependencyInjection; | ||
using Community.VisualStudio.Toolkit.DependencyInjection.Core; | ||
using EnvDTE; | ||
using Microsoft.VisualStudio.Shell; | ||
using PackageReferenceVersionToAttributeExtension.Services; | ||
|
||
/// <summary> | ||
/// Solution node command. | ||
/// </summary> | ||
[Command( | ||
PackageGuids.guidPackageReferenceVersionToAttributeExtensionCmdSetString, | ||
PackageIds.PackageReferenceVersionToAttributeSolutionNodeCommand)] | ||
internal sealed class SolutionNodeCommand( | ||
DIToolkitPackage package, | ||
LoggingService loggingService, | ||
ProjectService projectService, | ||
FileSystemService fileSystemService) | ||
: BaseDICommand(package) | ||
{ | ||
private readonly BaseCommand baseCommand = new(loggingService, projectService, fileSystemService); | ||
|
||
/// <inheritdoc/> | ||
protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) | ||
{ | ||
await this.baseCommand.ConvertPackageReferenceVersionElementsToAttributesAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+793 Bytes
(400%)
src/PackageReferenceVersionToAttributeExtension/Resources/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.