-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
dotnet ef migrations fails with Directory.Build.props #23691
Comments
@eddieparker Thanks for reporting this; we will investigate in the new year. |
If the |
Can I ask what you set the --msbuildprojectextensionpath to? Using the above zip file I've tried:
|
I haven't downloaded your zip, but seems that you didn't set the base of relative path. For me it was |
Here is the correct way to configure MSBuildProjectExtensionsPath in your project: <Project> <!-- Note: No Sdk="" here. -->
<PropertyGroup>
<!-- Don't use $(Configuration) since it isn't set yet. -->
<MSBuildProjectExtensionsPath>$(MSBuildProjectDirectory)\_intermediate_\</MSBuildProjectExtensionsPath>
</PropertyGroup>
<!-- MSBuildProjectExtensionsPath must be set before this gets imported. Directory.Build.props is too late. -->
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!-- (Project content goes here) -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project> Then you can use the option on the command line: dotnet ef migrations add InitialCreate --msbuildprojectextensionspath _intermediate_ Trying to set it anywhere else will result in very unexpected behavior that you'll probably need to use a tool like MSBuild Log Viewer to understand why it's not working. |
As @huoyaoyuan found, the easiest thing to do is to not touch |
Using the attached zip file, I can't get
dotnet ef migrations add InitialCreate
to work with the given Directory.Build.props. I've tried various incantations of --msbuildprojectextensionspath and they all yield the following error:If you delete the Directory.Build.props file the sample builds fine however.
Include provider and version information
EF Core version: 5.0.1
Database provider: Sqlite
Target framework: .netcore 3.1
Operating system: Windows
IDE: VS2019 16.8.3
EFMigrateTest.zip
The text was updated successfully, but these errors were encountered: