dotnet / dotnet/EntityFramework.Docs

Documentation for `EFMigrations` msbuild target

Aperta
#2,829 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area-migrations
Lingua principale
Mermaid
Stelle
1.7k
Fork
2k
Merge medio
7g 23h
PR unite (30g)
16

Descrizione

## 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
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia con l'esempio EFMigrations di .csproj e l'output di _GenerateEFSQLScripts da dotnet publish. Analizza il codice sorgente dell'attività MSBuild EFMigrations, quindi documenta la configurazione necessaria per eseguirla durante la pubblicazione e includere il file SQL generato nella directory finale /publish.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
build-system, documentation
Tipo di issue
Documentazione
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.