Skip to content

Sample: Use default bin and obj directories locally#1033

Merged
MichaelSimons merged 2 commits intodotnet:masterfrom
bricelam:dotnet-ef
Apr 18, 2019
Merged

Sample: Use default bin and obj directories locally#1033
MichaelSimons merged 2 commits intodotnet:masterfrom
bricelam:dotnet-ef

Conversation

@bricelam
Copy link
Contributor

@bricelam bricelam commented Apr 3, 2019

Changing BaseIntermediateOutputPath prevents "dotnet ef" from working.

Resolves dotnet/efcore#12220

cc @richlander @divega @ajcvickers

Changing BaseIntermediateOutputPath prevents "dotnet ef" from working.

Resolves dotnet/efcore#12220
@bricelam bricelam changed the title Use default bin and obj directories locally Sample: Use default bin and obj directories locally Apr 3, 2019
@ajcvickers
Copy link

@richlander Can this get merged? Is there someone else who should review?

@MichaelSimons
Copy link
Member

Is everyone satisfied with the guidance in the readmes (https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/dotnet-docker-dev-in-container.md#requirements & https://github.com/dotnet/dotnet-docker/blob/master/samples/aspnetapp/aspnet-docker-dev-in-container.md#requirements)? The guidance is rather open-ended. If there are problems/drawbacks with changing the local bin/obj, perhaps the wording should be adjusted to specifically call out you should only change the container bin/obj path.

To avoid conflicts between container usage and your local environment, you need to use a different set of obj and bin folders for each environment.

Make this change with the following steps:

Delete your existing obj and bin folders manually or use dotnet clean.
Add a Directory.Build.props file to your project to use a different set of obj and bin folders for your local and container environments.

@ajcvickers
Copy link

@richlander @MichaelSimons Any update? Can this get merged?

@MichaelSimons
Copy link
Member

@ajcvickers - Do you have thoughts on the question I posed (#1033 (comment))? I am of the opinion the readme should be updated as well per this change.

@ajcvickers
Copy link

@MichaelSimons I have no opinion on that; who would be able to make a call as to whether this is needed or not?

@raix
Copy link

raix commented Apr 15, 2019

@ajcvickers has anyone tested if a "local" build will overwrite the "container" folder? - the two builds need to coexist without interfering...

@divega
Copy link

divega commented Apr 15, 2019

If there are problems/drawbacks with changing the local bin/obj, perhaps the wording should be adjusted to specifically call out you should only change the container bin/obj path.

@MichaelSimons yes, I think it is a good idea to reflect this change in the guidance as well. Are you asking that @bricelam makes this changes also in the PR or can you do it after this after it is merged?

@ajcvickers
Copy link

@bricelam Can you answer the question from @raix

@MichaelSimons
Copy link
Member

The guidance and code should be in sync otherwise the samples are not coherant. I think it could be as simple as making the following tweak to the two readmes ((https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/dotnet-docker-dev-in-container.md#requirements & https://github.com/dotnet/dotnet-docker/blob/master/samples/aspnetapp/aspnet-docker-dev-in-container.md#requirements)).

To avoid conflicts between container usage and your local environment, you need to use a different set of `obj` and `bin` folders for your container environment.

 Make this change with the following steps:

 1. Delete your existing obj and bin folders manually or use `dotnet clean`.
 2. Add a [Directory.Build.props](Directory.Build.props) file to your project to use a different set of `obj` and `bin` folders for your container environments.

divega added a commit to divega/dotnet-docker that referenced this pull request Apr 16, 2019
So the guidance only talks about redirecting bin and obj folders for container, as suggested in dotnet#1033 (comment).
@bricelam
Copy link
Contributor Author

bricelam commented Apr 16, 2019

Will a "local" build overwrite the "container" folder?

It won't. The output assemblies will be like this. There won't be any overlap.

  • bin/Debug/netcoreapp2.2/Sample.dll
  • bin/container/Debug/netcoreapp2.2/Sample.dll
  • obj/Debug/netcoreapp2.2/Sample.dll
  • obj/container/Debug/netcoreapp2.2/Sample.dll

This approach relies on [volume mounting](https://docs.docker.com/engine/admin/volumes/volumes/) (that's the `-v` argument in the following commands) to mount source into the container (without using a Dockerfile). You may need to [Enable shared drives (Windows)](https://docs.docker.com/docker-for-windows/#shared-drives) or [file sharing (macOS)](https://docs.docker.com/docker-for-mac/#file-sharing) first.

To avoid conflicts between container usage and your local environment, you need to use a different set of `obj` and `bin` folders for each environment.
To avoid conflicts between container usage and your local environment, you need to use a different set of `obj` and `bin` folders for your container environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should get mirrored to aspnet as well.

Copy link
Contributor Author

@bricelam bricelam Apr 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording was different there, and it still made sense to me the way it was...

@MichaelSimons MichaelSimons merged commit c8350a5 into dotnet:master Apr 18, 2019
MichaelSimons pushed a commit to MichaelSimons/dotnet-docker that referenced this pull request May 3, 2019
* 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
MichaelSimons added a commit that referenced this pull request May 3, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't run ef commands using Directory.Build.props with seperate project and startup project

5 participants