aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 123 forks source link

VS 2017 RC3 Solution Explorer file nesting not persisting #981

Closed srivatsn closed 7 years ago

srivatsn commented 7 years ago

From @scottaddie on January 29, 2017 3:32

Here are the steps to reproduce in VS 2017 RC3 (15.0.26127.0 D15REL):

  1. Clone the following repo: https://github.com/scottaddie/TagHelpersDemo. This is an ASP.NET Core MVC project targeting .NET Core.
  2. Open the solution in VS, right-click the project in Solution Explorer, and choose Edit TagHelpersDemo.csproj from the context menu.
  3. Remove the Compile node (provided below) from the project file's ItemGroup, and save the f
    <Compile Update="Views\Shared\Partials\CardViewModel.cs" DependentUpon="Views\Shared\Partials\_Card.cshtml" />
  4. Add this Compile node back into the ItemGroup, and save the file. Notice that the CardViewModel.cs file is properly nested beneath _Card.cshtml in Solution Explorer.
  5. Close the solution, and then reopen it in VS. Notice that the file nesting is no longer present in Solution Explorer.

Copied from original issue: dotnet/roslyn-project-system#1366

srivatsn commented 7 years ago

From @abpiskunov on January 30, 2017 17:29

@lifengl

srivatsn commented 7 years ago

The file nesting is implemented in the web tools extension. So moving to the web tools repo.

abpiskunov commented 7 years ago

this is either something new in CPS or again same issue with circular nestings , which CPS needs to handle. Circular nesting issue was moved to U1 in CPS. We need to create a separate bug and reference original github issue form core project system

lifengl commented 7 years ago

Missed this thread. DependentUpon should not contain a path, it should contains only the file name inside the same folder.

lifengl commented 7 years ago

Also, not sure whether using DependentUpon as an attribute works well at this point.

scottaddie commented 7 years ago

@lifengl Is there a more reliable way to use DependentUpon (e.g., as a child node of Compile)?

lifengl commented 7 years ago

The correct syntax is:

<Compile Update="Views\Shared\Partials\CardViewModel.cs" DependentUpon="_Card.cshtml" />

DependentUpon was interpreted in that folder, and relative/full path is not supported. Only a file name can be used here.

Some of our logic might remove the rest, and uses the only file name part (which is incorrect, you can change to randomFolder_card.cshtml but see the same behavior), but some are not . For the project you provide, the defined behavior is that CardViewModel.cs should not be nested under _Card.cshtml.

scottaddie commented 7 years ago

I can confirm that the file nesting works reliably after switching to the <Compile /> node provided above. I'm hoping that IntelliSense will eventually be provided, so that people know a full path isn't supported for DependentUpon.

mlorbetske commented 7 years ago

Glad to hear you got it working