是否可以创建一个快捷方式来将未使用的用法删除到类中?

时间:2015-07-23 14:14:37

标签: c# visual-studio

我通常会尝试清除未使用的代码,原因可以通过this发帖回答。

每当我想要这样做时,我必须使用我的鼠标,这可能有点烦人,所以这就是为什么我想在快捷方式中实现它。 e.g:

enter image description here

这就是结果。

enter image description here

我找不到任何有用的东西。

2 个答案:

答案 0 :(得分:7)

工具菜单上,选择选项,打开环境文件夹,然后选择键盘

键盘页面上,选择键盘映射方案

显示包含的命令文本框中,键入<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion> <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>12.0</OldToolsVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> <UpdateEnabled>false</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> <TargetFrameworkProfile /> </PropertyGroup> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <SchemaVersion>2.0</SchemaVersion> <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectGuid>{2153C73F-1BA9-49F8-BAB2-84F7769BD67A}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>VersionOne.Integration.Tfs.Policy.Deployment.VS2013</RootNamespace> <AssemblyName>VersionOne.Integration.Tfs.Policy.VS2013</AssemblyName> <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> <GeneratePkgDefFile>false</GeneratePkgDefFile> <IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer> <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer> <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment> <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory> <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <CreateVsixContainer>True</CreateVsixContainer> <DeployExtension>True</DeployExtension> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> <Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\logo.ico"> <Link>logo.ico</Link> <IncludeInVSIX>true</IncludeInVSIX> </Content> <Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\RegistryKeyToAdd.pkgdef"> <Link>RegistryKeyToAdd.pkgdef</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> <IncludeInVSIX>true</IncludeInVSIX> </Content> <Content Include="..\VersionOne.Integration.Tfs.Policy.Deployment.Shared\LICENSE.md"> <Link>LICENSE.md</Link> <CopyToOutputDirectory>Always</CopyToOutputDirectory> <IncludeInVSIX>true</IncludeInVSIX> </Content> <None Include="app.config" /> <None Include="source.extension.vsixmanifest"> <SubType>Designer</SubType> </None> </ItemGroup> <ItemGroup> <BootstrapperPackage Include=".NETFramework,Version=v4.5"> <Visible>False</Visible> <ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName> <Install>true</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1</ProductName> <Install>false</Install> </BootstrapperPackage> </ItemGroup> <ItemGroup> <ProjectReference Include="..\VersionOne.Integration.Tfs.Policy.VS2013\VersionOne.Integration.Tfs.Policy.VS2013.csproj"> <Project>{24b4af99-795b-4b33-ad1d-fd51f32e2aeb}</Project> <Name>VersionOne.Integration.Tfs.Policy.VS2013</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

在滚动列表框中,选择要执行快捷方式的命令。 在“使用新快捷方式”下拉列表中,选择要使用快捷方式的环境。如果希望快捷方式适用于所有上下文,请选择“全局”。

将光标放在按快捷键(s)文本框中,然后按住非文本键或非文本键组合(例如Alt,Ctrl或Shift)并键入文本键你的选择。 选择分配。

source

答案 1 :(得分:3)

工具&gt;选项,导航到键盘选项卡。搜索“Edit.RemoveAndSort”,该命令将删除未使用的使用并对使用进行排序,然后设置快捷方式