Did .Net 5 change from .Net Core 3.1 in regards to files automatically being included in a project?

Data Juggler 181 Reputation points
2020-12-24T18:37:15.937+00:00

My open source project DataTier.Net (https://github.com/DataJuggler/DataTier.Net) has a feature where after i code generate files that make up a data tier I would launch a tool called Visual Studio Project Updater I wrote where I include all the code generated files in a multi-project data-tier.

.Net Core came along, and I no longer had to do this for .Net Core projects, so my code had a contition:

// Only launch the VS Project Updater if this new files were added and this is a .Net Framework project

// This is only needed for a .Net Framework project, as Dot Net Core didn't need this                    
if ((this.HasFileManager) && (FileManager.WereNewFilesCreated) && (!project.DotNetCore))
{
    // include the files generated in the project.
    IncludeProjectFiles();
}

Recently I started converting to .Net 5, and I abandoned support for .Net Core, but I noticed .Net 5 files are not automatically included in a project/solution after code generation in a folder of the project.

Did this change between .Net Core 3.1 and .Net 5?

I ported to .Net 5 and changed the above to (!project.Net5) and the files are not included when new files are added.

Yes I know how to manually include the files, it is about 7 files per database table, and if there are many tables it is a pain to do it manually, that is why I wrote my VS Project Updater. The new problem is my VS project editor for .Net Framework so I am sure this will require a change to convert to .Net 5 project structure.

I can't find any documentation or don't where to look on changes between .Net 5 and .Net Core 3.1.

I just want my code generator to work in .Net 5 and this change threw me a curve I wasn't expecting after a month of updating Nuget packages.

Thank you.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,996 questions
{count} votes

Accepted answer
  1. Data Juggler 181 Reputation points
    2020-12-24T22:38:23.473+00:00

    I figured it out, it was a problem in my code I think.

    New files were added, but if I had a file in a project, removed it, then created another file with the same name it was not getting included.

    To fix this I added a field called Excluded to my table called DTNTable, which already had a field called Exclude. I use the new field to make sure Exclude (a user set variable) always matches Excluded (a system set variable) else I show the project updater.

    My project updater works for .Net Framework and .Net Core projects, as I forget Visual Studio is still a .Net Framework project.

    This issue can be closed.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.