Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add generated files to fsproj #20

Closed
simon-reynolds opened this issue Jan 25, 2019 · 5 comments
Closed

Automatically add generated files to fsproj #20

simon-reynolds opened this issue Jan 25, 2019 · 5 comments

Comments

@simon-reynolds
Copy link
Collaborator

Both scaffolding and creating migrations results in new files being added to the project

Unlike C# the compilation order of F# is important so we will need to add them to the fsproj in the appropriate place within the project

Currently any generated files have to be added to the fsproj file manually

@RonaldDijks
Copy link

This might be something we cannot get around without considerable work. If we were to also generate the includes, we'd have to either:

  1. Make assumptions about the project structure and order of imports.
  2. Actually figure out the order of imports, which probably would be doable buy waaaay outside of the projects scope at the moment.

I think that if we mention it in the docs, it would be fine, because once you know where the migrations are created you can just add migrations/* (I assume).

As much as I love ordered imports, this is one of the problems that I ran into a few times while generating F# code for other projects.

Is this a must have, or can we do without it? :)

@bricelam
Copy link
Member

Can we just update Bricelam.EntityFrameworkCore.FSharp.targets with this:?

<ItemGroup>
  <CompileAfter Include="$(MSBuildProjectDirectory)Migrations\**\*.fs" />
</ItemGroup>

@bricelam
Copy link
Member

bricelam commented Apr 22, 2019

Well, probalby with some hooks for those who deviate from the defaults...

<PropertyGroup>
  <EFCoreMigrationsDir Condition="'$(EFCoreMigrationsDir)' == ''">
    $(MSBuildProjectDirectory)Migrations\
  </EFCoreMigrationsDir>
</PropertyGroup>
<ItemGroup>
  <CompileAfter Include="$(EFCoreMigrationsDir)**\*.fs" />
</ItemGroup>

@bricelam
Copy link
Member

bricelam commented Apr 22, 2019

We may even be able to warn info when they deviate. Something like...

📎 It looks like you're trying to scaffold migrations into a custom directory. Did you know can set the <EFCoreMigrationsDir> MSBuild property to have these files included automatically?

@simon-reynolds
Copy link
Collaborator Author

Closing as duplicate of #43

@simon-reynolds simon-reynolds closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants