What great timing again Tim. We just today discussed this topic and how we are going to go about enforcing common coding styles. This is going to help a lot. Thanks for the video.
@IAmTimCorey2 жыл бұрын
Great!
@Tsunami142 жыл бұрын
I remember a previous video of yours which showed how to set coding styles at a per-user level, and my immediate question was if this can be set per project/solution and checked into source control. Glad to see this has been addressed.
@tomthelestaff-iamtimcorey75972 жыл бұрын
Thanks for being a consistent and faithful follower of Tim content!
@NiquelBones Жыл бұрын
For anyone having issues creating the editorconfig file, it's actually not rendering in the solution explorer, you'll have to open the solution in the regular windows explorer and drag the created file to the IDE to open it, if you're having more issues there is a video called "EditorConfig file doesn't work in Visual Studio 2022? Here is a workaround" that gives a good explanation and solution.
@IAmTimCorey Жыл бұрын
Thanks for sharing.
@EricKing2 жыл бұрын
Those Visual Studio bugs are embarrassing. Thanks for the video.
@IAmTimCorey2 жыл бұрын
You are welcome.
@YousefSh2 жыл бұрын
I do wish you ran code cleanup so we can see it in action. But this video helped me understand editorconfig a lot!
@IAmTimCorey2 жыл бұрын
Glad it helped!
@alekseev742 жыл бұрын
Nice feature. Will use it in my new project.
@IAmTimCorey2 жыл бұрын
Great!
@biscuitbakerful2 жыл бұрын
Tim, I had to add an additional step to get VS to use file scoped namespaces. I had to update my project properties to use C# version 10. example: net6.0 10
@IAmTimCorey2 жыл бұрын
Are you using VS2019? You shouldn’t need to do that. Glad you got it to work, though.
@biscuitbakerful2 жыл бұрын
@@IAmTimCorey I am using VS2022, but we are using .Net 5 at work.
@MrBan001 Жыл бұрын
can I create a .editorconfig that has all values of the default settings from visual studio inside it? Because all the settings which are Visual Studio Settings and not read from the .editorconfig could still be different per developer
@almightyknight1272 жыл бұрын
Thanks man,this is exactly what I was looking for
@IAmTimCorey2 жыл бұрын
You are welcome.
@edburdo2 жыл бұрын
Hi Tim. Great video. I have a question... when I add the EditorConfig to my solution (VS2019) - It's all text. I don't have the nice UI that you do. Just the text. Is that a plugin, or difference in project types?
@IAmTimCorey2 жыл бұрын
I think that’s the problem. I’m using VS2022. If this isn’t for work, VS2022 Community Edition is free and you can install it side by side with VS2019.
@sandroco2 жыл бұрын
Very informative, thx :) But in my case the Code Style settings have no effect. If I set "Prefer Braces", "Yes" and "Error", no error is shown when I create a if(x) y = x statement. Even if I restart VS (VS Community 2022) nothing happens. I have added the configfile to the solution. Why's that?
@unnamedsandwich Жыл бұрын
Hi previously when I open .editorconfig, it opens with code and not this interface. How do I revert it to that?
@milestonetrucks95882 жыл бұрын
I do not get a choice of new editor config. I get New Item , or installation config I'm using Visual Studios 2022 running 6.0 ? any help
@christianista Жыл бұрын
It's not possible to import this file as default for all projects ?
@IAmTimCorey Жыл бұрын
No, not really. This file is meant to be shared with your team, so even if you set up your Visual Studio to use these defaults, it would not work with your team.
@thelebanesehunter Жыл бұрын
I'm trying to add editConfig as you did, also using another way by clicking on the project tab > add new item > search for editorConfig and click on the default one, or the .NET one, but still don't see anything added on my solution explorer, any idea?
@michael-tsai Жыл бұрын
Hi, I think it's a bit late for this. If the issue still exists, I just record a video showing a workaround. You can find that video from my KZbin channel.
@sumanthdsharma2 жыл бұрын
I created editor configuration file in visual studio 2022 but it never throws any error if do just what you did. Block and other thing it didn't complain of anything.
@andreibicu55922 жыл бұрын
Neither on my side. I wonder why use this instead of other external analyzers ?!
@matejlaskomulej7 ай бұрын
It doesn't really work well. ``` root = true [*] end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = space indent_size = 4 trim_trailing_whitespace = true ``` This for example removes trailing whitespace in *.cs files, but not in *.md. `Ctrl+K,Ctrl+D` doesn't work in markdown at all, and I cannot find the fix with google or chatgpt for the life of me.
@syltis1994 Жыл бұрын
Anyone has any experience with VS not doing anything when you select the option to add a EditorConfig file? I have to add it manually, and even then VS does not display it in the Solution Explorer. VS 2022.
@IAmTimCorey Жыл бұрын
It is quirky sometimes, for sure.
@richiehatch67192 жыл бұрын
I don't have the option to add a new editor config when right-clicking. Does anyone know how to address this? Edit: I am using VS 2022, and the menu item does not show up even in brand new projects. I do have the intellicode module installed. Second Edit: For anyone else having issues, as of now, download and install the preview version of 2022.
@IAmTimCorey2 жыл бұрын
It sounds like you might have needed an update or a feature added. I'm using Visual Studio 2022 Community Edition (not the preview edition) and it works.
@richiehatch67192 жыл бұрын
@@IAmTimCorey That's crazy, not sure what I need to add then because I can add the new editor config but I still don't have the good looking UI. I appreciate the response! Let's me know that something still isn't correct.
@IAmTimCorey2 жыл бұрын
OK, further update: mine just disappeared with the latest update in VS2022 (non-preview). It is still in the preview version. It must be a glitch. You can still right-click and add new item and add the .NET editorconfig.
@richiehatch67192 жыл бұрын
@@IAmTimCorey Ah! I appreciate the update. I spent far too long trying to figure out why it wasn't working.
@richardzhang80282 жыл бұрын
Right click .editorconfig file, then "Open With ...", then choose resource file, you will get an error. Then you are good.
@TCFdemonblade2 жыл бұрын
Nice feature, but it is not working properly. If you init a git repo, the editorconfig won't save anymore. The only way to use it with git is to generate the file again by using the button from VS Setting.
@tomthelestaff-iamtimcorey75972 жыл бұрын
Thanks for sharing what you encountered.
@user-rz1hv Жыл бұрын
editorconfig is broken in vs 2022, at least for wpf projects, "Syntax tree is required to accomplish the task but is not supported by document [XAML file name].xaml"
@IAmTimCorey Жыл бұрын
Interesting. Have you submitted a ticket about it?
@user-rz1hv Жыл бұрын
@@IAmTimCorey not yet
@NeZversSounds2 жыл бұрын
What a BS, I don't have it on VS 2022 as it is shown in the video nor in the documentation under New Item.
@IAmTimCorey2 жыл бұрын
If you are on the Windows version of Visual Studio 2022 and have updated, you should have it. If not, submit a support ticket. Also, make sure you are looking in the right spot to add it. It is on the Add menu when clicking on the Solution or Project files. You can also add it manually when adding new files (not new projects).