C# and .NET Version Mapping
VS Error: project.assets.json Not Found
Tools -> Command Line -> Developer Command Prompt -> Enter msbuild -t:restore
https://learn.microsoft.com/zh-cn/nuget/consume-packages/package-restore-troubleshooting
Clear NuGet Cache
Delete the packages folder at the same level as the .sln file, remove the generated 000_exe folder, delete the .nuget folder in the user directory on C drive, and remove all bin/obj folders.
dotnet format -v d command to format code
Change the NuGet Packages Cache Location
The default cache location for nuget_packages is C:\Users\win.nuget\packages, which may take up several gigabytes.
Find the file C:\Users\win\AppData\Roaming\NuGet\NuGet.Config, typically located at C:\Users\User\AppData\Roaming\NuGet\NuGet.Config. Open this file and add the following configuration under the configuration node:
Modify the Default Location of Local Packages
Default location for local packages: C:\Program Files (x86)\Microsoft SDKs\NuGetPackages. Change it to D:\Program Files (x86)\Microsoft SDKs\NuGetPackages.
Two steps: first, copy all content from C:\Program Files (x86)\Microsoft SDKs\NuGetPackages to D:\Program Files (x86)\Microsoft SDKs\NuGetPackages; second, update the path in C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config.
Used to resolve conflicts between NuGet packages and private packages with the same name, specifying whether each package comes from the public NuGet or a private source.
Package Source Mapping
Used to resolve conflicts between NuGet packages and private packages with the same name, specifying weather each package comes from the public NuGet or a private source.
https://learn.microsoft.com/zh-cn/nuget/consume-packages/package-source-mapping
Central Package Management
https://learn.microsoft.com/zh-cn/nuget/consume-packages/central-package-management
Right-click the solution -> Add -> New Item
Use dotnet-tocpm to Create CPM
https://github.com/DEVDEER/dotnet-tocpm
tocpm -h check if installed properly tocpm simulate . analyze current package references tocpm execute . generate Directory.Packages.props y yes
</div>
### Git Large File Management
https://git-lfs.com/
### **Common PowerShell Commands for Developers**
**dotnet list package**
**Create a new gitignore**
### **VS2022 Support for Chinese Localization for NET6**
Tools -> Command Line -> Developer PowerShell
<div>```
dotnet tool install -g islocalizer
islocalizer install auto -m net6.0 -l zh-cn
islocalizer build -m net6.0 -l zh-cn -cc OriginFirst -sl '---------'k
You can view more commands using islocalizer -h.
This method updates the XML files in C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.25\ref\net6.0, adding two folders named "zh-cn" and "zh-hans". Due to the new approach introduced by .NET 6, which uses SDK-style project files and more flexible NuGet package management, you need to copy these two folders from C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.25\ref\net6.0 to C:\Users\win.nuget\packages\microsoft.netcore.app.ref\6.0.27\ref\net6.0, where the latter path depends on the specific location.
Open Folder with VSCode
VSCode Opens .sln but Code Area Is Not Colored
Set the language mode.
Differences Between Task.Wait(), Result, and Task.GetAwaiter().GetResult()
When exceptions ocurr in Task, the former wraps them in AggregateException, while the latter throws the exception directly; the latter can be used instead of the former.