Skip to content

Commit 1cde708

Browse files
committed
Add Visual Studio 2022 support
1 parent b04b9b7 commit 1cde708

27 files changed

+406
-42
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
# ResourceMonitor
22
A Visual Studio extension for monitoring CPU, RAM, disk and Battery usage.
3+
4+
This extension supports:
5+
- Visual Studio 2019
6+
- Visual Studio 2022
7+
38
## Download
4-
[Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=HO-COOH.ResourceMonitor)
9+
For Visual Studio 2019 -> [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=HO-COOH.ResourceMonitor)
10+
11+
For Visual Studio 2022 -> [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=HO-COOH.ResourceMonitor2022)
12+
513
## Usage
614
~~1. ``Tools`` -> ``Start Monitor``~~ No need. It automatically loads now :)
715
![](./assets/1.png)
16+
817
1. Now it will appear in the status bar.
18+
919
![](./assets/2.png)
1020

21+
Now supports Visual Studio 2022 too:
22+
23+
![](./assets/3.png)
24+
25+
1126
## Plans
1227
- ~~Add a setting menus for changing the refresh speed.~~
1328
- ~~Add settings for displaying different things.~~
1429
- ~~Able to run on start up~~
30+
- ~~Visual Studio 2022 support~~
1531

1632
### Note:
1733
Partially inspired by:

ResourceMonitor.csproj

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
<PropertyGroup>
1111
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
1212
</PropertyGroup>
13+
<PropertyGroup>
14+
<ApplicationIcon>SharedFiles\VSPackage1.ico</ApplicationIcon>
15+
</PropertyGroup>
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
17+
<OutputPath>bin\Debug\</OutputPath>
18+
</PropertyGroup>
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
20+
<OutputPath>bin\Release\</OutputPath>
21+
</PropertyGroup>
1322
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1423
<PropertyGroup>
1524
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -51,17 +60,7 @@
5160
<WarningLevel>4</WarningLevel>
5261
</PropertyGroup>
5362
<ItemGroup>
54-
<Compile Include="Battery.cs" />
55-
<Compile Include="Command1.cs" />
56-
<Compile Include="CPU.cs" />
57-
<Compile Include="Disk.cs" />
5863
<Compile Include="Properties\AssemblyInfo.cs" />
59-
<Compile Include="RAM.cs" />
60-
<Compile Include="ResourceMonitorPackage.cs" />
61-
<Compile Include="Options.cs">
62-
<SubType>Component</SubType>
63-
</Compile>
64-
<Compile Include="Units.cs" />
6564
</ItemGroup>
6665
<ItemGroup>
6766
<None Include="Key.snk" />
@@ -80,13 +79,13 @@
8079
<Reference Include="System.Xml" />
8180
</ItemGroup>
8281
<ItemGroup>
83-
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.205" ExcludeAssets="runtime" />
84-
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.6.2051" />
85-
</ItemGroup>
86-
<ItemGroup>
87-
<VSCTCompile Include="ResourceMonitorPackage.vsct">
88-
<ResourceName>Menus.ctmenu</ResourceName>
89-
</VSCTCompile>
82+
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.10.31321.278" ExcludeAssets="runtime">
83+
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
84+
</PackageReference>
85+
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232">
86+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
87+
<PrivateAssets>all</PrivateAssets>
88+
</PackageReference>
9089
</ItemGroup>
9190
<ItemGroup>
9291
<Content Include="2.png">
@@ -101,15 +100,11 @@
101100
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
102101
<IncludeInVSIX>true</IncludeInVSIX>
103102
</Content>
104-
<Content Include="Resources\Command1.png" />
105-
<Content Include="Resources\VSPackage1.ico" />
106-
</ItemGroup>
107-
<ItemGroup>
108-
<EmbeddedResource Include="VSPackage.resx">
109-
<MergeWithCTO>true</MergeWithCTO>
110-
<ManifestResourceName>VSPackage</ManifestResourceName>
111-
</EmbeddedResource>
103+
<Content Include="SharedFiles\Command1.png" />
104+
<Content Include="SharedFiles\VSPackage1.ico" />
105+
<VSCTCompile Include="SharedFiles\ResourceMonitorPackage.vsct" />
112106
</ItemGroup>
107+
<Import Project="VS2022\VS2022.projitems" Label="Shared" />
113108
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
114109
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
115110
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

ResourceMonitor.sln

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,51 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30128.74
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31815.197
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceMonitor", "ResourceMonitor.csproj", "{6CD8DE78-3620-4380-B055-F6EB5F931237}"
77
EndProject
8+
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "VS2022", "VS2022\VS2022.shproj", "{0965E028-B866-49BF-ADA0-74AF57302DCA}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VS2022Support", "VS2022Support\VS2022Support.csproj", "{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}"
11+
EndProject
812
Global
13+
GlobalSection(SharedMSBuildProjectFiles) = preSolution
14+
VS2022\VS2022.projitems*{0965e028-b866-49bf-ada0-74af57302dca}*SharedItemsImports = 13
15+
VS2022\VS2022.projitems*{1c5dc8f1-e081-45aa-9398-2a1d4f05094a}*SharedItemsImports = 4
16+
VS2022\VS2022.projitems*{6cd8de78-3620-4380-b055-f6eb5f931237}*SharedItemsImports = 4
17+
EndGlobalSection
918
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1019
Debug|Any CPU = Debug|Any CPU
20+
Debug|x64 = Debug|x64
21+
Debug|x86 = Debug|x86
1122
Release|Any CPU = Release|Any CPU
23+
Release|x64 = Release|x64
24+
Release|x86 = Release|x86
1225
EndGlobalSection
1326
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1427
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1528
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|Any CPU.Build.0 = Debug|Any CPU
29+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|x64.ActiveCfg = Debug|Any CPU
30+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|x64.Build.0 = Debug|Any CPU
31+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|x86.ActiveCfg = Debug|x86
32+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Debug|x86.Build.0 = Debug|x86
1633
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|Any CPU.ActiveCfg = Release|Any CPU
1734
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|Any CPU.Build.0 = Release|Any CPU
35+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|x64.ActiveCfg = Release|Any CPU
36+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|x64.Build.0 = Release|Any CPU
37+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|x86.ActiveCfg = Release|x86
38+
{6CD8DE78-3620-4380-B055-F6EB5F931237}.Release|x86.Build.0 = Release|x86
39+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Debug|Any CPU.Build.0 = Debug|Any CPU
41+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Debug|x64.ActiveCfg = Debug|x64
42+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Debug|x64.Build.0 = Debug|x64
43+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Debug|x86.ActiveCfg = Debug|x64
44+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Release|Any CPU.ActiveCfg = Release|Any CPU
45+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Release|x64.ActiveCfg = Release|x64
47+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Release|x64.Build.0 = Release|x64
48+
{1C5DC8F1-E081-45AA-9398-2A1D4F05094A}.Release|x86.ActiveCfg = Release|Any CPU
1849
EndGlobalSection
1950
GlobalSection(SolutionProperties) = preSolution
2051
HideSolutionNode = FALSE
File renamed without changes.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
3+
4+
<!-- This is the file that defines the actual layout and type of the commands.
5+
It is divided in different sections (e.g. command definition, command
6+
placement, ...), with each defining a specific set of properties.
7+
See the comment before each section for more details about how to
8+
use it. -->
9+
10+
<!-- The VSCT compiler (the tool that translates this file into the binary
11+
format that VisualStudio will consume) has the ability to run a preprocessor
12+
on the vsct file; this preprocessor is (usually) the C++ preprocessor, so
13+
it is possible to define includes and macros with the same syntax used
14+
in C++ files. Using this ability of the compiler here, we include some files
15+
defining some of the constants that we will use inside the file. -->
16+
17+
<!--This is the file that defines the IDs for all the commands exposed by VisualStudio. -->
18+
<Extern href="stdidcmd.h"/>
19+
20+
<!--This header contains the command ids for the menus provided by the shell. -->
21+
<Extern href="vsshlids.h"/>
22+
23+
<!--The Commands section is where commands, menus, and menu groups are defined.
24+
This section uses a Guid to identify the package that provides the command defined inside it. -->
25+
<Commands package="guidResourceMonitorPackage">
26+
<!-- Inside this section we have different sub-sections: one for the menus, another
27+
for the menu groups, one for the buttons (the actual commands), one for the combos
28+
and the last one for the bitmaps used. Each element is identified by a command id that
29+
is a unique pair of guid and numeric identifier; the guid part of the identifier is usually
30+
called "command set" and is used to group different command inside a logically related
31+
group; your package should define its own command set in order to avoid collisions
32+
with command ids defined by other packages. -->
33+
34+
<!-- In this section you can define new menu groups. A menu group is a container for
35+
other menus or buttons (commands); from a visual point of view you can see the
36+
group as the part of a menu contained between two lines. The parent of a group
37+
must be a menu. -->
38+
<Groups>
39+
<Group guid="guidResourceMonitorPackageCmdSet" id="MyMenuGroup" priority="0x0600">
40+
<Parent guid="guidSHLMainMenu" id="IDM_VS_MENU_TOOLS"/>
41+
</Group>
42+
</Groups>
43+
44+
<!--Buttons section. -->
45+
<!--This section defines the elements the user can interact with, like a menu command or a button
46+
or combo box in a toolbar. -->
47+
<Buttons>
48+
<!--To define a menu group you have to specify its ID, the parent menu and its display priority.
49+
The command is visible and enabled by default. If you need to change the visibility, status, etc, you can use
50+
the CommandFlag node.
51+
You can add more than one CommandFlag node e.g.:
52+
<CommandFlag>DefaultInvisible</CommandFlag>
53+
<CommandFlag>DynamicVisibility</CommandFlag>
54+
If you do not want an image next to your command, remove the Icon node /> -->
55+
<Button guid="guidResourceMonitorPackageCmdSet" id="Command1Id" priority="0x0100" type="Button">
56+
<Parent guid="guidResourceMonitorPackageCmdSet" id="MyMenuGroup" />
57+
<Icon guid="guidImages" id="bmpPic1" />
58+
<Strings>
59+
<ButtonText>Start Monitor</ButtonText>
60+
</Strings>
61+
</Button>
62+
</Buttons>
63+
64+
<!--The bitmaps section is used to define the bitmaps that are used for the commands.-->
65+
<Bitmaps>
66+
<!-- The bitmap id is defined in a way that is a little bit different from the others:
67+
the declaration starts with a guid for the bitmap strip, then there is the resource id of the
68+
bitmap strip containing the bitmaps and then there are the numeric ids of the elements used
69+
inside a button definition. An important aspect of this declaration is that the element id
70+
must be the actual index (1-based) of the bitmap inside the bitmap strip. -->
71+
<Bitmap guid="guidImages" href="Command1.png" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows, bmpPicStrikethrough"/>
72+
</Bitmaps>
73+
</Commands>
74+
75+
<Symbols>
76+
<!-- This is the package guid. -->
77+
<GuidSymbol name="guidResourceMonitorPackage" value="{daf19364-8cbf-4d18-8dd6-fc735742fb5d}" />
78+
79+
<!-- This is the guid used to group the menu commands together -->
80+
<GuidSymbol name="guidResourceMonitorPackageCmdSet" value="{425d3eaa-9e76-410f-b38b-41b6afcd4eb0}">
81+
<IDSymbol name="MyMenuGroup" value="0x1020" />
82+
<IDSymbol name="Command1Id" value="0x0100" />
83+
</GuidSymbol>
84+
85+
<GuidSymbol name="guidImages" value="{723bc055-ddac-4f02-b668-d286c815f68d}" >
86+
<IDSymbol name="bmpPic1" value="1" />
87+
<IDSymbol name="bmpPic2" value="2" />
88+
<IDSymbol name="bmpPicSearch" value="3" />
89+
<IDSymbol name="bmpPicX" value="4" />
90+
<IDSymbol name="bmpPicArrows" value="5" />
91+
<IDSymbol name="bmpPicStrikethrough" value="6" />
92+
</GuidSymbol>
93+
</Symbols>
94+
</CommandTable>

SharedFiles/VSPackage1.ico

418 KB
Binary file not shown.

SharedFiles/logo.png

7.58 KB
Loading

Battery.cs renamed to VS2022/Battery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static (int, int, int) BatteryRemains
1919
int remainsInHour = remainsInSeconds / 60 / 60;
2020
int remainsMinute = (remainsInSeconds - remainsInHour * 3600) / 60;
2121
int remainsSecond = remainsInSeconds - remainsInHour * 3600 - remainsMinute * 60;
22-
return (remainsInHour, remainsMinute, remainsInSeconds);
22+
return (remainsInHour, remainsMinute, remainsSecond);
2323
}
2424
}
2525

File renamed without changes.

Command1.cs renamed to VS2022/Command1.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ private void UpdateSettings()
3838
{
3939
var options = (OptionPage)GetDialogPage(typeof(OptionPage));
4040

41+
refreshInterval = options.RefreshInterval;
42+
4143
showCPU = options.ShowCPU;
4244

4345
showRam = options.ShowRAM;
@@ -133,7 +135,7 @@ private static string SizeUnitToStr(SizeUnit unit)
133135
return "";
134136
}
135137

136-
private async void GetSolutionDir()
138+
private async Task GetSolutionDir()
137139
{
138140
try
139141
{

0 commit comments

Comments
 (0)