The ASP.NET code behind the file is not embedded in the corresponding aspx file in Visual Studio

On my C # ASP.NET website using the .NET Framework 4.0, I have a couple of pages where the associated .cs file is not under its associated aspx file. I recently moved files to a subdirectory. I have 10 pages, and for 8 of them, the movement worked fine, and the .cs file is under aspx. However, for two pages, the .cs file no longer appears below the aspx file. How can I fix this so that cs is shown correctly under the aspx file? When I compare the top of the markup page, the two problem pages look the same as the other 8 pages. I do not see any problems there.

+3
source share
3 answers

. Solution Explorer, . - , . . . , .cs aspx.

+2

, ( ). , -, 3 (.aspx,.aspx.cs, aspx.designer.cs), → " ". . - (: ), → " ".

VS 2010 Solution Explorer

+3

In general, for VS projects, nesting is done by an element <DependentUpon/>. You can fix this by editing the project file directly. Change:

    <Compile Include="blah.child" />

To:

    <Compile Include="blah.child">
      <DependentUpon>blah.parent</DependentUpon>
    </Compile>

This works for any file attachments such as .sass -> .css -> .min.css

0
source

All Articles