![visual studio format document with visual studio format document with](https://scotch-res.cloudinary.com/image/upload/v1563847465/czyb5upqyrai8ves2snj.png)
Simply run it from the NuGet Package Manager Console: Format-Document This will re-format all files of the selected project. When you reopen Visual Studio, the command is available. Phil used davidfowl's Format-Document method which he found at : # Function to format all documents based on Edit the profile with the command notepad $profile.Īdd the reusable method to the NuGet profile.
![visual studio format document with visual studio format document with](https://static.javatpoint.com/cpages/images/how-to-run-a-c-program-in-visual-studio-code31.png)
Type mkdir –force (split-path $profile) to create the profile's folder if it does not exist.Type $profile to see the location of your NuGet profile.Phil Haack outlined a good procedure - adding a reusable script to indent the project. Then, this script works in Visual Studio 20. You need to apply the answer by Marcus Mangelsdorf as well. Note, that the following solution does not work by itself starting with Visual Studio 2015. Note that this is older than the version available on github above.
#VISUAL STUDIO FORMAT DOCUMENT WITH CODE#
The original code is available at the blog post. You have to keep an eye on it as it's interactive and does sometimes pop up a message and wait for an answer. It runs "edit, format document" on every document of the listed file types. Here's a handy macro script for visual studio I knocked together today. Tim Abell wrote a macro to do this on his blog: The Format All Files extension worked for me.