-
Notifications
You must be signed in to change notification settings - Fork 258
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
project.assets.json does not work with shared intermediates #4463
Comments
good issue. we think we can change without too much work...but likely too late for rtm. |
Agreed, this would be a good change. We've been working towards making this file name/path extensible, but there a few places still expecting |
Yeah, let's fix it later - just make sure you coordinate with us. |
|
Good to know, we should be respecting that: dotnet/project-system#1437 |
Make note - this also affects two projects in the same directory: dotnet/project-system#1528 |
When I define a different Example:
All other files get moved correctly, except for these 3 which still appear in
|
update by @nkolev92 NuGet now respects Please refer to dotnet/msbuild#1603 and NuGet/NuGet.Client#2131 and NuGet/NuGet.Client#2121. Original comment: #4463 (comment) |
Given where the base intermediate path is set, you can't set it without expanding SDK into explicit imports of a props and targets. |
I am trying to run a Docker container that has code mounted into it while also developing on the host inside of an IDE. The IDE keeps running Dotnet Restore and conflicting with the Docker container's Dotnet Restore. I have to do multiple mounts to exclude the Is there another solution to this besides for waiting for the ability to name |
Can you expand on the issues you have with EF and dotnet test when you change BaseIntermediateOutputPath with a bug over on http://github.com/roslyn-project-system? I'll move them to the appropriate repros if it's a bug in those tools. |
Yes, I will do that in a few days. Thanks! |
@davkean Does this mean that having a shared intermediate folder is supported once these issues are fixed? |
@jdasilva These are two issues that I found scouting it - but I've not confirmed that it's fully supported yet. Sounds like @caleblloyd was running into issues that I'd like to capture |
Thanks, I was thinking about a comment like this dotnet/sdk#760 (comment). I've been using a common intermediate folder for a couple of projects since at least VS2013 and this still works under VS2017 with the old project system. I'd love to move to the new one, so I really meant "supported" in the sense of if something blocks this will it be considered a bug? You seem to be doing that already which is great and I just want to make sure I'm on the same page. |
@jdasilva Sorry missed this comment (for some reason NuGet issues go to my personal email). Yes we'd consider anything blocking multiple projects from building to a common intermediate as a bug - this is the reason that we prefix most things in obj with the project name. This issue is the last one that I know that is blocking building to a common intermediate folder (MSBuild fixed their last one) |
Here's another issue that results as a problem of this - dotnet/project-system#1935. Basically, building a new csproj in the same directory as the old csproj, breaks the build because the old csproj picks up the same assets file. |
@davkean when will dotnet/project-system#1437 be fixed? |
@SwooshyCueb yes that would work. As long as the |
I think a best effort should be made to make the path unique in common cases. Consider the trivial case of two projects in the same folder with default output paths. For ages, this simple case worked because everything put the project name in obj files, until assets file came along. So I think it is good to have the error as you suggest, but I still see value in being unique by default up to project name. |
There are no technical blockers anymore afaik. The concern would be the migration plan. This needs to be carefully analyzed to avoid fall outs similar to what we had to fix with dotnet/sdk#14517. |
This solution does not work anymore with net sdk 6.0 (installed yesterday) Directory.build.props:
C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1004: Assets file 'D:\Applications\AAA\obj\BBB_yzakfkig_wpftmp\project.assets.json' not found. Run a NuGet package restore to generate this file. [D:\Applications\AAA\BBB_yzakfkig_wpftmp.csproj] The error is only with WPF projects, the project.assests.json gets placed in the folder without the mangling (BBB). |
@mkonijnenburg since this is specific to WPF, it's related to WPF's targets/props (SDK). I created an issue there: dotnet/wpf#5679 For what it's worth, the problem you found is unrelated to this issue. This isssue is about two csproj files in the same directory (or otherwise using the same obj folder). Your |
I hit this so many times but there's no way to rename From what I saw in both NuGet and .NET SDK targets, the work needs to be in both. I can think of two solutions here. Most projects don't need disambiguation as they are restored in to their own project folder but cases like the above happen when the same project folder contains two projects (may be targeting different versions of the dependencies). This could be fixed with #5154 as you then no longer need two project workarounds. Another requirement to have many projects within the same folder is to simply build different assemblies with varying public surface API (think, Lite and Full modules). With .NET Framework, we have With those reasons stated above, I can think of two solutions here. One is to enable #5154 and other is to have a disambiguation between restore assets by project name or file when they are in the same folder. The former ask could be bigger than just a simple refactor but the latter could be just that depending on how the assets file feature is implemented in the codebase. I'm willing to take this on If the team accepts the request and guides me on where I should make the changes. |
I found this and whilst exploring the code and various properties, I found that adding a Directory.build.props file with the following content resolved the build issue where the project.assets.json conflicts with two projects.
Just ideas and notes I had whilst resolving my current issue.
yes, i realize that i end up with $(Configuration) in my folder twice, but this lets me build debug and release versions of our internal nuget packages and swap them out on the fly. If IntermediateOutputPath was respected by nuget, then i could remove one layer, it's inconsequential as long it builds, deploys and runs. |
To reply to my prior comment, it gets worse. The Azure DevOps task for Nuget Restore generates a new targets file for msbuild, then calls it. Thus, completely obliterating any chance of finding the Directory.Build.props file. |
You're hitting a limitation in NuGet.exe, tracked in #6734. If possible, we recommend using Regarding the IntermediateOutputPath idea, NuGet is explicitly configuration agnostic, but that itself really related to this particular issue. |
@nkolev92 Thanks, I actually switched to the msbuild command yesterday, i'm glad though to see that it is a recommended path. Thanks for the advise and everything you do! |
I'm running into this with nearly any project I have, since I like to have my unit tests close to the code, i.e.
Those Except when I introduce NuGet, i.e. to add NUnit or Moq as dependencies: the unit test project will fail to compile as if NUnit or Moq weren't present in the dependencies. There is no build message of any kind to indicate that the NUnit reference was invalid or dropped or anything - so it likely uses the dependencies of the non-unit-test project. Since this |
You can use MSBuildProjectExtensionsPath to define a unique location for the assets file. |
Files that generated into the intermediates, typically always include the project name in the name of the file:
The assets file does not:
This is going to lead to clashes when projects share intermediate directories, which is pretty common in large projects such as Roslyn.
The text was updated successfully, but these errors were encountered: