VS2019 Tweaks

Costas

Administrator
Staff member
Disable experience
fttDGbv.jpg


Disable useless Codelens
MERMO6h.jpg


Disable Sourcecontrol
vtkuwB1.jpg


Set the common shortcut for un/comment
YqiJhoW.jpg


Disable Downloading IntelliSense index for nuget, add this to your registry :
JavaScript:
//src - https://developercommunity.visualstudio.com/content/problem/754438/downloading-intellisense-index-for-nugetorg-visual.html
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\16.0_879e2b99\Roslyn\Features\SymbolSearch]
"Enabled"=dword:00000000


add the following to hosts (you will not able to renew your license on community editions)
JavaScript:
127.0.0.1 go.microsoft.com aka.ms download.visualstudio.microsoft.com download.microsoft.com download.visualstudio.com dl.xamarin.com xamarin-downloads.azureedge.net marketplace.visualstudio.com gallerycdn.vsassets.io visualstudio.microsoft.com docs.microsoft.com msdn.microsoft.com www.microsoft.com windows.net microsoftonline.com live.com web.vortex.data.microsoft.com vortex.data.microsoft


no tested - Disable telemetry in Visual Studio 2019
https://gist.github.com/zeffy/f0fe4be391a2f1a4246d0482bbf57c1a




Tips

VS - must have
ne9ohMY.png


Build from explorer context menu without open VS2019

kQV8Zyr.jpg


JavaScript:
//for other versions check - https://stackoverflow.com/a/744449
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln\Shell\Build (Debug)\command]
@="\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.com\" %1 /Build Debug"

NuGet
ZO7qYbq.jpg


JavaScript:
Update-Package –reinstall

//nuget sources
C:\Users\%username%\AppData\Roaming\NuGet\NuGet.Config

nuget.exe doesnt exist to VS, is integrated into MSBuild, cmd example :
JavaScript:
//https://social.msdn.microsoft.com/Forums/vstudio/en-US/2021d22c-2d81-4e40-9791-39c34567b19a/restore-nuget-packages-using-devenv?forum=msbuild
//cd /d C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin
msbuild.exe /t:restore /t:build urpath2sln

VS2017 - set per solution custom nuget server
create the NuGet.config near the projectname.sln, paste
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</config>

<packageRestore>
<!-- Allow NuGet to download missing packages -->
<add key="enabled" value="True" />

<!-- Automatically check for missing packages during build in Visual Studio -->
<add key="automatic" value="True" />
</packageRestore>

<packageSources>
<clear />
<add key="NeXuS" value="https://neddet/" />
</packageSources>

<!-- Used to store credentials -->
<packageSourceCredentials />

<!-- Used to disable package sources -->
<disabledPackageSources />
</configuration>

Create your own nuget server/proxy

JSON to Class
Available in Visual Studio 2017 and later versions, user have the json to clipboard, creates a new class, then by menu Edit > Paste special.​

Git
JavaScript:
//reset hard
git reset --hard

//clean files
git clean -xdf

//ignore last local commit. Editor will open > close it. more https://www.pipiscrew.com/2020/05/git-undo-pushed-commits-local-and-remote/
git commit --amend

VS - add reference is broken *fix*
JavaScript:
//src - https://stackoverflow.com/a/57810776/1320686

-goto VS cmd
-change dir to
cd /d C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies

-run
gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll
gacutil -i Microsoft.VisualStudio.Shell.Interop.12.0.dll

VS - won't find references
JavaScript:
//https://stackoverflow.com/a/37986888

make sure your projects target the same framework

disable scrollbar circus
BD4p643.png


disable updates
7mdkFJ9.png


on slow pc
TPJUTWy.jpg


Disable 'Enable Just My Code' (ref)
Disable 'Enable Diagnostic Tools while debugging' (ref)
EtgWPI2.png


Debug inside DLL - Reflector Visual Studio Extension or Generate a PDB with dotPeek

Load symbols you need only. Options > Debug > Sumbols > Load only specified modules write DLL filename as Test.dll
kkkXDqH.jpg



SQL Server 2018 - Disable updates
Tools > Check for updates > on the new form there is a checkbox "Automatically check for updates"



batch script to delete bin/obj folders for all projects are near SLN
JavaScript:
@echo off
for /f "delims=" %%D in ('dir /a:d /b') do (

    if exist %%~fD (
        if exist %%~fD\bin (
            rmdir /s /q "%%~fD\bin\"
            echo [deleted] %%~fD\bin\
        )
 
        if exist %%~fD\obj (
            rmdir /s /q "%%~fD\obj\"
            echo [deleted] %%~fD\obj\
        )
    )
)
pause





~~Remove VS2019 TaskRunnerExplorer extension~~

Currently tested with VS ASP.NET flavor.

Close VS.

Go
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Web Tools

backup (copy) the

TaskRunnerExplorer (folder)
extension.vsixmanifest

--

on source

1-open to text editor the
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Web Tools\TaskRunnerExplorer\Microsoft.WebTools.TaskRunnerExplorer.pkgdef

on top written
JavaScript:
[$RootKey$\Packages\{b483c4e7-43a6-4f7b-a9a1-79e2c5d12148}]

write to a paper the {b483c4e7-43a6-4f7b-a9a1-79e2c5d12148} ;)


2-delete folder

TaskRunnerExplorer


3-edit
extension.vsixmanifest
remove the following lines
JavaScript:
// file : extension.vsixmanifest
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="TaskRunnerExplorer\Microsoft.WebTools.TaskRunnerExplorer.pkgdef" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="TaskRunnerExplorer\Microsoft.WebTools.TaskRunnerExplorer.Extensions.pkgdef" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="TaskRunnerExplorer\Microsoft.WebTools.TaskRunnerExplorer.dll" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="TaskRunnerExplorer\Microsoft.WebTools.TaskRunnerExplorer.Extensions.dll" />

4-a key needed to removed from the registry
a- Start regedit.exe and select the node HKEY_USERS
b- File > Load Hive, navigate to %localappdata%\Microsoft\VisualStudio\
you will see a folder writes a version ex 16.0_83f6bcec, enter in, there you will
find privateregistry.bin, select it and click open.
c- Regedit will ask you for a base name (is temporary) so give anything like word test
d- you will find the key test @ HKEY_USERS\test, browse at
HKEY_USERS\test\Software\Microsoft\VisualStudio\16.0_83f6bcec_Config\Packages\
find the key that you wrote on paper from step 1 and delete it!
e- Go back to tree and select the HKEY_USERS\test then File > Unload hive

ref - https://www.docdroid.net/ph44FgW
ref - Modify the Registry of Another User


Visual log w/ modded xsl
start VS with '/log', goto :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE

JavaScript:
devenv.exe /log


ActivityLog.xml will generated at :
C:\Users\%username%\AppData\Roaming\Microsoft\VisualStudio\16.0_83f6bcec

To see the loading duration/times, copy&overwrite the modded ActivityLog.xsl (by default named ActivityLogProfiler.xsl, rename it to ActivityLog.xsl) near ActivityLog.xml (dont worry, every time VS writes also the xsl)

to read the XML properly drop it to InteretExplorer, example :
wymVXIh.png




Delete some things for speed

>>Private registry
Disable TaskStatusCenter ({EDFBCDC9-574E-40E1-8167-B8AAB25AC6CB}) dont remove it, IDE not working properly
0VinaIA.jpg


on the first startup after modification, select No, restart VS.

successfully removed the following :
JavaScript:
Keys [-HKEY_USERS\test\Software\Microsoft\VisualStudio\16.0_83f6bcec_Config\Packages\{xx} contains
"Class"="Microsoft.VisualStudio.Data.Tools.DataCompare.VSPackage"
"Class"="Microsoft.VisualStudio.Services.ServiceBroker.GlobalHubClientPackage"
"Class"="Microsoft.VisualStudio.TeamFoundation.PCW.PcwPackage"
"Class"="Microsoft.VisualStudio.TeamFoundation.VersionControl.SccPcwPluginPackage"
"Class"="Microsoft.VisualStudio.WindowsAzure.CommonAzureTools.CommonAzureToolsPackage"
"Class"="Microsoft.VisualStudio.Docker.DotNetFramework.DockerDotNetFrameworkPackage"
"Class"="Microsoft.VisualStudio.Docker.Compose.DockerComposePackage"
"Class"="Microsoft.VisualStudio.DevOps.DevOpsPackage"
"Class"="Microsoft.Kofe.DebugPackage.KofePackagePackage"
"Class"="MS.Internal.Package.XamlDesignerPackage"
"Class"="Microsoft.VisualStudio.Linux.Package.LinuxConnectionManagerPackage"
"Class"="Microsoft.VisualStudio.Docker.LanguageService.DockerLanguageServicePackage"
"Class"="Microsoft.VisualStudio.PlatformUI.CloudEnvironmentsPackage"
"Class"="Microsoft.TeamFoundation.Git.Provider.SccProviderPackage"
"Class"="Microsoft.VisualStudio.DesignTools.Diagnostics.XamlDiagnosticsPackage"
"Class"="Microsoft.VisualStudio.FSharp.Editor.FSharpPackage"
"Class"="Microsoft.VisualStudio.Docker.DotNetCore.DockerDotNetCorePackage"
"Class"="Microsoft.WebTools.BrowserLink.Package.EurekaPackage"
"Class"="Microsoft.VisualStudio.PowerShellTools.PowerShellToolsPackage"
"Class"="Microsoft.VisualStudio.FSharp.ProjectSystem.FSharpProjectPackage"
"Class"="Microsoft.VisualStudio.Shell.Connected.CloudEnvironments.CloudEnvironmentsPackage"
"Class"="Microsoft.VisualStudio.TeamFoundation.TeamFoundationHost"
"Class"="Microsoft.VisualStudio.Data.Tools.SqlPdwExtensions.SqlPdwExtensionsPackage"
"Class"="Microsoft.WebTools.TaskRunnerExplorer.Extensions.TaskRunnerExplorerExtensionsVsPackage"
"Class"="Microsoft.VisualStudio.Data.Tools.SqlLanguageServices.Package"
"Class"="Microsoft.VisualStudio.Docker.Compose.Tools.DockerVsSettingsPackage"
"Class"="Microsoft.VisualStudio.Data.Tools.SqlEditor.VSIntegration.SqlEditorPackage"

>>File
+ delete CompatibilityList.xml
<code>C:\Users\%username%\AppData\Local\Microsoft\VisualStudio\16.0_83f6bcec\Extensions\CompatibilityList.xml</code>




<del datetime="2020-05-28T16:02:15+00:00">Disable unwanted services to run - delete or rename the ServiceHub folder :
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7</del> dont do it, find all references and Project Filename search will not work
3RB8wSO.jpg


10 Visual Studio Navigation Productivity Tips



bundleconfig.json

NqYtHxL.png

VS Extension - Bundler & Minifier - https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier (author)



IIS
JavaScript:
//disable Attach security warning when debugging IIS
// https://www.pipiscrew.com/2020/05/disable-visual-studio-attach-security-warning-when-debugging-iis/

//restart
iisreset /restart

//start-stop manually
iisreset /stop
iisreset /start

//start-stop HTTP driver (IIS depends on this)
net stop http
net start http

exe lives in C:\Windows\System32\inetsrv

server configuration (applicationhost.config)
%windir%\system32\inetsrv\config\

cache (dont delete) C:\Users\%username%\AppData\Local\Microsoft\WebsiteCache

//recycle the pool via cmd
cd /d %systemroot%\System32\inetsrv
appcmd recycle apppool /apppool.name:"app pool"

//more - https://www.pipiscrew.com/2020/05/iis-symbols-not-loaded/

//Backup and Restore IIS
//src - https://chrislazari.com/backup-and-restore-iis-on-windows-server-2016/
source pc:
C:\Windows\System32\inetsrv
appcmd add backup "<backup name>"
then backup will made to  C:\Windows\System32\inetsrv\backup

destination pc:
C:\Windows\System32\inetsrv
create the backup folder, type
appcmd list backup
appcmd restore backup "<backup name>"


IIS connections, number of concurrent connections
hk35qHj.jpg


ref


IIS depends on HTTP windows driver
read more..


IIS - Pending request for ever

read more..


Jexus Manager can replace IIS Manager and adjust settings also on IIS Express
https://github.com/jexuswebserver/JexusManager
https://docs.jexusmanager.com/

<code>
Portable Installation
In certain cases, you might not be able to execute the MSI installer on some machines.
-Install Jexus Manager from the MSI installer on a spare machine.
-Copy all files in the installation folder to the target machine.
</code>
src - https://docs.jexusmanager.com/getting-started/install.html

apart from Manager, you can use (for linux only) Jexus Server or here. Alternatively Host ASP.NET Core on Linux with Nginx



Nartac.IIS Crypto

Gives the ability to enable or disable protocols, ciphers, hashes and key exchange algorithms on Windows Server 2008, 2012, 2016 and 2019. It also lets you reorder SSL/TLS cipher suites offered by IIS, change advanced settings.

https://www.nartac.com/Products/IISCrypto/



On SQLServer , enable the line numbers

yUYRDvr.jpg


Enable - Show pinned tabs in a separate row

Query Optimization
Once you write your query > rclick > Display Estimated Execution Plan when the cost is high you can rclick the specific > Properties find where stack probably at 'Seek Predicates'

or

Once you write your query > rclick > Analyze Query in Dbase Engine Tuning Advisor > on hte next form press the toolbar Play button.

Renew expired certification for localhost

run certmgr.msc from dos, you can find all the certificaties are on the system, among the others you will find under 'Trusted Root Certification Authorities' the one for localhost

RJqpu9w.png


if you getting ERR_CONNECTION_RESET / expired_ssl / no_valid_ssl while trying to debug an asp.net site you have to renew the certificate. Either

Bash:
in folder C:\Program Files\IIS Express

# creates a new self-signed certificate for all sites hosted by IIS Express
iisexpress.exe /regiis

# creates a self-signed SSL certificate for the specified URL and PORT
iisexpressadmincmd.exe /setupsslurl:"https://localhost:44350" /useselfsigned

visiting again the certmgr.msc will reveal the new certificate. ;)


#tweak #lite
 
Top