-
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
Can't run ef commands using Directory.Build.props with seperate project and startup project #12220
Comments
FYI I have recently been seeing this error when there is a duplicate PK in entity seed data AND there is a watcher on the project (i.e. |
Same problem here. |
Thank you @lukyer, the workaround works! |
Is everyone using the same Notes for triage: One way to fix this is for us to hijack the |
@bricelam I believe the file is created when you create a project on VS with docker integration |
I don't see it any of the templates, but I did find it here https://github.com/dotnet/dotnet-docker/tree/master/samples |
@richlander Changing |
@divega to follow up. |
@richlander Can you direct us to who might know about changing |
@bricelam We followed this guide https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/dotnet-docker-dev-in-container.md#requirements |
That's correct @raix. That accurately describes the motivation for the pattern. The workflow works very poorly without this pattern. |
If we set these properties to absolute path, it appears to be prepending the project path to it.
|
Marking this as blocked until dotnet/dotnet-docker#1033 is merged. |
* Use default bin and obj directories locally Changing BaseIntermediateOutputPath prevents "dotnet ef" from working. Resolves dotnet/efcore#12220 * Update dotnet-docker-dev-in-container.md
This issue may fixed for docker but I redirect bin and obj folders for a different reason. It is not fixed for me. |
@nvmkpk Please file a new issue fully explaining your scenario. |
@nvmkpk You're free to change the |
@bricelam I tried that too and it did not work. I don't remember what error I ran into of top of my head. I will try that again and file a new issue. Only thing that worked for me was to temporarily disable the folder redirection. |
It's a tricky property to override, you need to set it before the SDK targets are imported. You may need to decompose your project files from this... <Project Sdk="Microsoft.NET.Sdk">
<!-- ... -->
</Project> ...to this. <Project>
<PropertyGroup>
<!-- NOTE: Must be set before imporing Sdk.props -->
<BaseIntermediateOutputPath>$(MSBuildProjectDirectory)/myobj/</BaseIntermediateOutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<!-- ... -->
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project> |
I did not have to modify my project file. I set it in Directory.Build.props. This file is imported before any other imports and it just worked for my case. |
Does that mean using |
I meant to say building and debugging works without any issues with my Directory.Build.props file. I am getting below error whether or not I specify the
|
Can you submit a new issue with a repro attached? |
* Use default bin and obj directories locally Changing BaseIntermediateOutputPath prevents "dotnet ef" from working. Resolves dotnet/efcore#12220 * Update dotnet-docker-dev-in-container.md
* Use default bin and obj directories locally Changing BaseIntermediateOutputPath prevents "dotnet ef" from working. Resolves dotnet/efcore#12220 * Update dotnet-docker-dev-in-container.md
I'm seeing the exact same issue as @nvmkpk . Was this ever addressed? Was a new issue created? |
@guitarzan I never got time to create an issue and a repro. Please feel free to create one if you can. |
I started creating a repro, but it is working now. I think I was mis-typing either the path to the project or the obj folder. I would still prefer that dotnet-ef respect the settings in the Directory.Build.props file, but at least there is this workaround. |
I've created a repro and created a new issue here in case anyone wants to follow/comment on it: #23691 Alternatively, I'd appreciate solutions if I'm doing something wrong. :) |
Upgrading to ASP.Net Core 2.1 added a new recommendation for using Docker as a development environment, which is to add a
Directory.Build.props
file that will specify where to put theBaseIntermediateOutputPath
andBaseOutputPath
depending on the executing environment.With the
Directory.Build.props
in place everything works as expected exceptdotnet ef
commands. I'm runningdotnet ef migrations list -s ./Y/ -p ./X/
The error generated is,By following the error's recommendation and adding the
--msbuildprojectextensionspath
option with the valueobj/local
, i.e.dotnet ef migrations list -s ./Y/ -p ./X/ --msbuildprojectextensionspath ./X/obj/local
, the error reoccurs though now it's requesting that the other project in question's--msbuildprojectextensionspath
be given. Error meesageRunning this now with
dotnet ef migrations list -s ./Y/ -p ./X/ --msbuildprojectextensionspath ./Y/obj/local
everything works as expected.Directory.Build.props
contents are,The directory structure of the project is,
I'm running this in the local environment and all commands were run form the
src
directory.This looks similar to #8816, though I'm not sure how to get this work with
Directory.Build.props
. Can you please assist in providing a solution to this issue?Further technical details
EF Core version: 2.1.0
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: mac OS 10.13
IDE: Visual Studio Code
The text was updated successfully, but these errors were encountered: