Visual studio 2017 : nesting files in a class library project

后端 未结 2 603
日久生厌
日久生厌 2021-01-13 20:01

In web projects you have the option of nesting files

 + startup.cs
   +--startup.internals.cs
   +--startup.configuration.cs

Is there any

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-13 20:35

    To answer your Updates : Partially solved:

    Something similar to this issue. DependentUpon is the correct element to use to achieve the nesting that you want.

    But, your value cannot be expression that includes wildcards. It must be a single file that is under the same folder or a sub-folder. If your file exists in a sub-folder, you must specify the file via a relative path. So the content of your ItemGroup should be like this:

    
    
      startup.cs
    
    
      startup.cs
    
    

    And after my check, I think you need to use the Include attribute instead of Update if you are building a .NET FX class library project.

    Update: The Update attribute is available only for .NET Core projects according to this doc.

    And if in a .NET Core project, like what you indicated in a comment, maybe Update is more suitable:

    
      startup.cs
    
    

提交回复
热议问题