MSBuild.EntityFrameworkCore.RemoveDesignerCompilation
Makes sure that only the last N .Designer.cs files from Entity Framework Core Migrations are compiled.
Install / Use
/learn @MichelZ/MSBuild.EntityFrameworkCore.RemoveDesignerCompilationREADME
MSBuild.EntityFrameworkCore.RemoveDesignerCompilation
This MSBuild task is designed to remove the compilation of *.Designer.cs files of Entity Framework Core migrations, except for the last N files. It is a simple way to keep your project clean and minimize build times.
To achieve this, the task needs to move the [Migration] and [DBContext] properties from the Designer file to the main file.
This is done by using regular expressions, so it is not guaranteed to work in all cases. If you find a case where it does not work, please open an issue and I will try to fix it.
It also needs to add the namespace for your DBContext, so be sure to set that if it's not the same namespace as your project's root namespace.
Getting Started
To start using this package, simply add it as a NuGet package to your project.
Prerequisites
- .NET Core SDK 3.1 or higher
- Entity Framework Core 3.1 or higher
Installation
- Add the NuGet package to your project:
dotnet add package MSBuild.EntityFrameworkCore.RemoveDesignerCompilation
Configuration
You can customize the behavior of this task by setting the following properties in your project file:
<PropertyGroup>
<RDC_Enabled>true</RDC_Enabled>
<RDC_MigrationFilesPath>$(ProjectDir)\Migrations</RDC_MigrationFilesPath>
<RDC_DBContextNamespace>$(RootNamespace)</RDC_DBContextNamespace>
<RDC_DesignerFileCountToKeep>2</RDC_DesignerFileCountToKeep>
</PropertyGroup>
RDC_Enabled: Whether to enable the MSBuild task. Default istrue.RDC_MigrationFilesPath: The path where your Entity Framework Core migration files are located. Default is$(ProjectDir)\Migrations.RDC_DBContextNamespace: The namespace used for your DbContext. Default is the project's root namespace.RDC_DesignerFileCountToKeep: The number of most recent*.Designer.csfiles to keep compiling. Default is2.
Usage
Once you have configured the properties, simply build your project as usual. The MSBuild task will automatically remove the compilation of older *.Designer.cs files in your migration folder, keeping only the last N files as specified in the RDC_DesignerFileCountToKeep property.
The MSBuild task will also modify your main migration files to include the [Migration] and [DBContext] attributes that were previously in the *.Designer.cs files, so be sure to commit those changes.
Known Issues
The following known issues exist:
- These files are needed for actual migrations
- It should work with a "going forward" approach, when you don't need to create additional databases, and you don't need to revert older migrations
- It has issues when you need to create additional databases (i.e. newly created database needs to be migrated to latest state)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Skills
diffs
339.5kUse the diffs tool to produce real, shareable diffs (viewer URL, file artifact, or both) instead of manual edit summaries.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
openpencil
1.8kThe world's first open-source AI-native vector design tool and the first to feature concurrent Agent Teams. Design-as-Code. Turn prompts into UI directly on the live canvas. A modern alternative to Pencil.
ui-ux-pro-max-skill
53.5kAn AI SKILL that provide design intelligence for building professional UI/UX multiple platforms
Languages
Security Score
Audited on Jan 8, 2026
