.NET Cheat Sheet

General Stuff

Clear all \bin \obj

Be careful were you run this, you could kill your OS install if you ran it somewhere like system32.

    Get-ChildItem .\ -include bin,obj -Recurse | foreach ($_) { remove-item $_.fullname -Force -Recurse }

Extract the Contents of an *.msi File

msiexec /a SSCERuntime-ENU-x64.msi

Get Strong Name From DLL File

"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -Tp (or just T for token) "D:\Code\samplesort-xp\SampleSort\SampleSort.Code.ScratchPad\bin\Debug\net6.0\SampleSort.Code.ScratchPad.dll"

Entity Framework 6

SQL Command Logging Config Element

<entityFramework>
    ...
    <interceptors>
        <interceptor type="System.Data.Entity.Infrastructure.Interception.DatabaseLogger, EntityFramework">
            <parameters>
                <parameter value="C:\home\site\wwwroot\app_data\SQLLogOutput.txt"/>
                <parameter value="true" type="System.Boolean"/>
            </parameters>
        </interceptor>
    </interceptors>
</entityFramework>

Nuget

# Clear the 3.x+ cache (use either command) dotnet nuget locals http-cache --clear nuget locals http-cache -clear # Clear the 2.x cache (NuGet CLI 3.5 and earlier only) nuget locals packages-cache -clear # Clear the global packages folder (use either command) dotnet nuget locals global-packages --clear nuget locals global-packages -clear # Clear the temporary cache (use either command) dotnet nuget locals temp --clear nuget locals temp -clear # Clear the plugins cache (use either command) dotnet nuget locals plugins-cache --clear nuget locals plugins-cache -clear # Clear all caches (use either command) dotnet nuget locals all --clear nuget locals all -clear "># Clear the 3.x+ cache (use either command)
dotnet nuget locals http-cache --clear
nuget locals http-cache -clear

# Clear the 2.x cache (NuGet CLI 3.5 and earlier only)
nuget locals packages-cache -clear

# Clear the global packages folder (use either command)
dotnet nuget locals global-packages --clear
nuget locals global-packages -clear

# Clear the temporary cache (use either command)
dotnet nuget locals temp --clear
nuget locals temp -clear

# Clear the plugins cache (use either command)
dotnet nuget locals plugins-cache --clear
nuget locals plugins-cache -clear

# Clear all caches (use either command)
dotnet nuget locals all --clear
nuget locals all -clear

After running any of these commands nuget could (read most likely will) throw a wobbly and complain about missing packages. If this does occur you can use the following command and options to get back to a working solution.

Firstly, do a safe reinstall of packages. The reinstall command is actually quite destructive in some instances without the -safe flag it will reinstall, but it will reinstall the very latest version of any package which could also introduce compatibility issues. So, run this:

Update-Package -Reinstall -Safe

If this is still an issue you can try executing “Clean Solution” then run the “Rebuild” option. If this still produces issues. Go to Tools -> Options -> Nuget Package Manager -> Clear All Nuget Cache(s). Restart VS (just to be safe) and then run another clean and rebuild.

This *should* fix things. If it doesn’t, it’s off the StackOverflow for you … sorry 🙂

Local NuGet Feeds

dotnet new nugetconfig

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="local-packages" value="../path/to-nupkg/files" />
  </packageSources>
</configuration>

Mobile Network Speeds

                        UP       DOWN
                  -------- ----------
gsm   GSM/CSD         14.4       14.4
hscsd HSCSD           14.4       57.6
gprs  GPRS            28.8       57.6
umts  UMTS/3G        384.0      384.0
edge  EDGE/EGPRS     473.6      473.6
hsdpa HSDPA         5760.0   13,980.0
lte   LTE         58,000.0  173,000.0
evdo  EVDO        75,000.0  280,000.0
full  No limit           ∞          ∞

Leave a Comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.