-
Notifications
You must be signed in to change notification settings - Fork 121
VS2017 - Please bring back file nesting in .NET Core projects #889
Comments
The nesting of the |
Thanks for the suggestion! We're actively working on this at the moment |
I'm really glad to hear it. I know this seems like a silly feature to some, but it's actually pretty major to me. |
TFS Bug#264170 |
Hey... I notice this is still broken in RC3. Is there any hope of this in RTM? |
Same with RC4. Any news? |
Due to outstanding amount of work in new csproj based project system we did not have time to do full support for custom nesting rules. It is scheduled for next update. However we did add a way for users to manipulate existing nesting rules via json file located here: C:\Users(youruser)\AppData\Local\Microsoft\VisualStudio\15.0_(yourinstanceid)\toolSettings.json (now this file lives under your VS install path: Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\toolSettings.json). You can deactivate some of the rules there or add some other file extensions, or change some rules order. Please treat that json file as temporary workaround, don't build extensions around that until more permanent changes will be shipped in coming updates. |
This is a good answer. Thank you. Not having the feature is frustrating, but just upfront being told why it isn't in there is very helpful. |
I would actually like to disable nesting of I'm used to working in VS Code on browser based client applications and the rules for nesting (hiding) in that IDE are pretty customizable. Is there a way to turn off nesting in ASP.NET Core projects in Visual Studio 2017? I see that if I change the solution to a "Folder View" then the files are no longer nested. Is this my only option? |
Yes, you could remove all nesting rules form your C:\Users(youruser)\AppData\Local\Microsoft\VisualStudio\15.0_(yourinstanceid)\toolSettings.json file and restart VS. |
@abpiskunov - can you give a little example of toolSettings.json structure... i tried this for nesting xaml.cs under .xaml for XamForms .Net Standard library project and restarted VS2017 (26628.10) but didn't seem to change anything:
|
Does this apply to aspt.net core projects only? i.e. If I open up a folder (i.e. not a solution or project) of web files and in the Team Explorer select "Show Folder View", the nesting rules don't seem to apply. Would be great if it could be extended to there as I use the VS IDE to work on projects which are primarily worked on by non-VS IDE developers. |
It is only for dotnet core projects for now. |
@Beej126 fileToFile rule need full file names , not just extensions. You need to use extensionToExtension rule. |
I appreciate that support was added for Good design even encourages dividing up a project into smaller pieces that are isolated from each other, and for Please look into this. It's just such a necessary feature for organizing. I find myself longing to go back to Visual Studio 2015 because of the lack of this. |
@ciel I am a little confused with what you referring as netcoreapp and neststandard... Dotnet Core projects can have both of them as targets. Did you actually mean two different project system types: DotNet Core (new project system) vs full .Net framework (classic project system)? |
Seems like file nesting is working in .NET Core web projects, for example: Doesn't seem to be working in non-web projects however, which was previously working in 2015. This was working in 2015, is this functionality going to be added back into 2017? |
We are using EF Core and running "dotnet ef migrations". The migration classes created have a *.Designer.cs file also, and none of them are nesting. How soon can we expect a fix? It's very jarring to open that folder now that it expands double the size and we lose all that screen real estate. |
cc @srivatsn |
FYI, nesting seems to be totally broken with .NET Standard Class Library in VS2017.3 Preview 2. Just used Would love to help get this fixed before 2017.3's RTM, as this is causing problems for us. Thanks! |
I spoke too soon. According to this link, the new
The key is that, because all files are included by default, you're updating an existing compilation reference, not creating a new one. You can use wildcards to do whatever you want... in this case I append Hopefully the tooling can get updated so that Mads' nesting tool can work properly. Thanks! |
I'm seeing nesting not working in VS2017 for .NET Core console applications. So if I add support for appsetttings to my app and then add appsettings.development.json it doesn't properly nest. This seems like a MAJOR step back. Really disappointed in the VS team for removing functionality which worked in VS2015. |
The 'toolSettings.json' work around would be nice, however, my findings show that this only applies to projects using the web SDK:
But this does not work for class library or console projects using 'Microsoft.NET.Sdk':
There are many cases outside of web projects where the ability to nest files without explicitly declaring each one is very beneficial. Is there a way to get the 'toolSettings.json' file to work for both project types? |
Yes, we are working to extend nesting support at the moment, it should be available in coming updates whenever is ready. |
based on your VS version nesting should be working, what exactly you mean by "nesting still not working"? Can you please provide more details?. Currently we are planning to update nesting in the bigger update that might happen in the end of the fall. |
@grokky1 to disable nesting you can remove everything from: VS install path: Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\toolSettings.json, and restart VS |
to disable nesting you can remove everything from: VS install path: Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\toolSettings.json, and restart VS |
This is the full path to the file:
Here's the content of my toolSetting.json file, I updated it a bit to nest typescript and css under html files:
|
Please make nesting an opt-in. I prefer a flat structure without hidden files. |
extensionToExtension means that file names should be identical but only extensions are different. In your case if you remove extensions you specified you would have different file names: UsersApi (.feature) and UsersApi.feature (.cs), that's why it does not work. In order to make it work do: |
I just wanted to let everyone know that since Visual Studio 2017 15.6 Preview 4 (which was made available a few days ago) users have the ability to control how file nesting works in Solution Explorer. Check out this blog posts for more details: |
@AngelosP That looks great! I would LOVE to see this happen for class library projects in addition to just asp.net core projects. |
I have difficulties with nesting in netcore projects as well. The biggest problem is that it makes the extension crashes with So my question - why do I have nesting for custom files in asp.net core projects? and how to disable it? |
Null exception you reported is not related to nesting and will be handled by corresponding team owning the stack. About the nesting question you have: please upgrade to VS 2017 15.6 Preview 4, we added support for manipulating nesting rules and creating your own. See this blog post: https://blogs.msdn.microsoft.com/webdev/2018/02/07/file-nesting-in-solution-explorer/ . |
why are you so sure? it happens only if diagram exists and nested (ie. it doesn't happen in other .net core projects where there's no nesting and it doesn't happen in aspnet core project if I delete .diagram file) as for file-nesting-in-solution-explorer, thanks it's interesting, but it's a feature for users as I understand. is it possible for an extension to control its files nesting? also I'd like to understand why is it happening for my custom extensions in asp.net core (.xdm and .xdm.diagram files) |
I am sure because nesting feature does not do anything with physical files, it just applies some settings in memory. In your scenario you are trying to save the file and it fails while trying to get files properties, which are beyond of control of nesting code path. It is underlying layer issue - CPS (Common Project System). It should not throw in general and even if it goes to that code path because of some nesting logic it is also not right, it should not. Anyway, as i said, owners would follow up with the issue on developer community. About nesting, yes, if you are creating an extension you can control what would be Default nesting settings for projects working with your extension. Look at Microsoft.VisualStudio.ProjectSystem.Components.dll. You would need to implement a MEF export for IDefaultNestingProfileProvider with Order that is higher than default providers in VS. Apply your extension's capability string to the provider for it to be applied only to projects working with your extension. |
If you need more details for implementation we could take it offline and continue via email. This issue will be closed soon. |
@abpiskunov thanks for explanation, I'll try to implement the mentioned interface, in case of difficulties I know who contact to ), thanks again. |
@abpiskunov It's too early to close. File nesting is still unavailable in v15.6 under the following conditions.
FileNesting does actually work if those conditions aren't met. I've even tried adding the following in the csproj to force it, but had no luck:
|
I would need to look at your sample app. The only thing for nesting to work is capabilities added to your project. By default Microsoft.NET.Sdk does not carry them, only web sdk have them. Thats said nesting enabled by default only for Asp.Net Core projects. If capabilities are added to Microsoft.NET.Sdk project then nesting will also be enabled, the only difference is you would need to select Web settings in the Solution Explorer toolbar explicitly, since there no Default nesting settings for Microsoft.NET.Sdk projects. OutputType and TargetFrameworks are irrelevant for nesting since this feature is working in a different way comparing to what DependentUpon does. Or more precisely it uses differnt types of settings which are independent on msbuild items. If DependentUpon is specified it wins, otherwise new nesting logic kicks in. Sample with DependentUpon that you posted did work for me. It probably means that something is wrong in the "old" DependentUpon based nesting, however, as i said, new nesting logic is different and still should work. |
Please add the file nesting support for Microsoft.NET.Sdk same as the Microsoft.NET.Sdk.Web. |
@Chavoshi This repo is for web issues onl and web projects already have nesting. You need to open issue at https://github.com/dotnet/project-system . Also to unblock yourself you could add these capabilities to your projects: and select Web settings in the Nesting toolbar selector. |
Thanks @abpiskunov for the explanation. |
@HarelM , I followed your instructions, but my angular files are still no grouped: Is there a specific thing I missed to make it work? |
Latest version of vs 2017 has this built in, no need to hack config files any more... |
Any updates on this lately? Is this tracked somewhere else? (Referring to Microsoft.NET.Sdk targeted projects). |
@SWarnberg See my last comment... |
Hmm, I have 15.7.5 and it doesn't work there for ,net standard projects. Are you referring to something else? |
The following tutorial worked for me as far as I remember: |
Yeah, I consider that as a "hack" since it doesn't work well in a distributed team. Yes, you can check it in to source control, but most of us expect common files like appsettings.json to be nested "out of the box" in other project types than just ASP.NET Core. |
@SWarnberg this issue is opened in aspnet repo and nesting is working in ASP.NET Core project, isn't it? If you want this feature to work in other project types then please add feedback for those project types (in their repos or through developer community web site) to increase count and visibility. This issue in aspnet repo is closed now. |
In Visual Studio 2015, we had file nesting via this amazing extension
However, in Visual Studio 2017 RC, that functionality no longer works outside of the built in file nesting for things like JavaScript/TypeScript.
This was a really valuable tool, and the author (@madskristensen) says that it can't be made to work in ASP.NET Core unless the tooling team makes changes. This was a very important part of my workflow for C# files, and I hope this is the right place to bring it up. I couldn't find another suggestion venue.
The text was updated successfully, but these errors were encountered: