dotnet / dotnet/EntityFramework.Docs

Documentation for `EFMigrations` msbuild target

Offen
#2,829 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area-migrations
Vorherrschende Sprache
Mermaid
Sterne
1.7k
Forks
2k
Ø Merge
7 T. 23 Std.
Gemergte PRs (30 T.)
16

Beschreibung

## Ask a question

I've been scouring the web trying to figure out how to get our migration script to be generated automatically as part of `dotnet publish`. Lots of old articles regarding including a migrate.exe... ick

I enabled diagnostic output on a dotnet-publish invocation and lo-and-behold, there's already an EFMigrations task!!!

But I can't seem to find any documentation for how to configure it, or how to ensure the file is included in the publish directory.

We're using dotnet core and publishing on macs and ubuntu (GitHub Actions), so the (very few) posts I've seen regarding configuring a pub.xml don't seem to apply (VS4mac doesn't seem to support customized publish profiles?)

Regardless, what I'm looking for is hopefully some documentation around how to use this task in our msbuild configuration such that it runs during publish, and is included in the final /publish directory.

I'd also be grateful if anyone just linked to the source of Task Class itself that backs this msbuild target...

So far, I've just blindly stumbled my way to adding:

```

```

to our .csproj file. And that has gotten us to:

```
_GenerateEFSQLScripts:
Generating Entity framework SQL Scripts...
Executing command: dotnet ef migrations script --idempotent --output "/Users/jasonkarns//obj/Release/netcoreapp3.1/win-x64/PubTmp/EFSQLScripts/FisContext.sql" --context FisContext
Generating Entity framework SQL Scripts completed successfully
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit dem .csproj-EFMigrations-Beispiel und der Ausgabe von _GenerateEFSQLScripts aus dotnet publish. Verfolge anschließend den Quellcode der EFMigrations-MSBuild-Aufgabe und dokumentiere die erforderliche Konfiguration, um sie während des Publish-Vorgangs auszuführen und die generierte SQL-Datei in das endgültige Verzeichnis /publish aufzunehmen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Bereich
build-system, documentation
Issue-Typ
Dokumentation
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.