You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failure publishing WPF app with RID can fail if intermediate path is overridden #366
It looks like these errors are due to the generated files being generated in two separate paths (one from the RID-less dotnet build, and the other from the dotnet publish with the RID specified), but both are being included in the WPF temporary generated project (likely because the Directory.Build.props intermediate path depends on the project name, which changes for the temporary project).
The best fix is probably to stop generating a temporary project, and instead call a target in the main project, if that's possible.
The idea I've had to do that would be to do something like multi-targeting where we build the same csproj, but change some global properties. I don't think this can just be a target in the same project evaluation as some of the targets need to run twice IIRC.
Looking at it a little closer, I'm not sure it's right to pin this on the temp project entirely.
I assume the goal of those statements in D.B. props is to account for projects in the same directory and make sure they each get thier own output and intermediate directories?
However, outting these underneath $(MSBuildProjectDirectory) doesn't work well with globs.
Here's a different case that will hit the same error.
mkdir repro && cd repro
dotnet new classlib
copy repro.csproj repro2.csproj
Create Directory.Build.props as defined in the issue description
I assume the goal of those statements in D.B. props is to account for projects in the same directory and make sure they each get thier own output and intermediate directories?
Correct. In the real scenario I took this from, there are two projects in the directory (one old-style csproj targeting NetFX and one new one targeting NetCore). It's an interim solution to allow using VS designers (via the old project) while porting to Core (via the new project). To avoid the globbing problem, the new csproj includes an explicit remove for anything under out\oldProject (<Compile Remove="out\OriginalProj\**\*.cs />).
Thinking about the temporary csproj, I can see how this could be an issue since the original project is removed but the temp project isn't. From the developer's point of view, though, they've excluded the only other csproj that should be using the \out\ directory, so it's a confusing problem. I think it's ok to expect developers to know that shared output folders can mess up globbing includes, but it's not a good experience to drop unexpected projects in that exacerbate the problem by also writing to those output locations.
A couple other items that seem odd about this:
Why is this only an issue when the intermediate output path is overridden?
Even when this issue repros, dotnet build seems to be ok. Why is it only publishing that runs into this?
Because BaseIntermediateOutputPath is excluded from globs and without customization all projects in the directory + temp project have a shared BaseIntermediateOutputPath
@ryalanms & I have been talking about ways to eliminate the temp project being created on the disk. It’s something he’d need to prototype to be sure that our intended approach would actually work...
Reacted by Tobias Käs, Nick Guerrera and Nirmal Guru
Activity
nguerrera commentedon Feb 20, 2019
@ryalanms
nguerrera commentedon Feb 20, 2019
We have had to do various workarounds for the wpf temp project. I agree it would be good to eliminate it.
See https://github.com/dotnet/arcade/search?q=IsWpfTempPRoject&unscoped_q=IsWpfTempProject
The idea I've had to do that would be to do something like multi-targeting where we build the same csproj, but change some global properties. I don't think this can just be a target in the same project evaluation as some of the targets need to run twice IIRC.
nguerrera commentedon Feb 20, 2019
Looking at it a little closer, I'm not sure it's right to pin this on the temp project entirely.
I assume the goal of those statements in D.B. props is to account for projects in the same directory and make sure they each get thier own output and intermediate directories?
However, outting these underneath
$(MSBuildProjectDirectory)doesn't work well with globs.Here's a different case that will hit the same error.
mkdir repro && cd reprodotnet new classlibcopy repro.csproj repro2.csprojSame errors:
mjrousos commentedon Feb 20, 2019
Correct. In the real scenario I took this from, there are two projects in the directory (one old-style csproj targeting NetFX and one new one targeting NetCore). It's an interim solution to allow using VS designers (via the old project) while porting to Core (via the new project). To avoid the globbing problem, the new csproj includes an explicit remove for anything under out\oldProject (
<Compile Remove="out\OriginalProj\**\*.cs />).Thinking about the temporary csproj, I can see how this could be an issue since the original project is removed but the temp project isn't. From the developer's point of view, though, they've excluded the only other csproj that should be using the \out\ directory, so it's a confusing problem. I think it's ok to expect developers to know that shared output folders can mess up globbing includes, but it's not a good experience to drop unexpected projects in that exacerbate the problem by also writing to those output locations.
A couple other items that seem odd about this:
dotnet buildseems to be ok. Why is it only publishing that runs into this?nguerrera commentedon Feb 20, 2019
stevenbrix commentedon Apr 4, 2019
@nguerrera are you taking this bug?
vatsan-madhavan commentedon Apr 4, 2019
@ryalanms & I have been talking about ways to eliminate the temp project being created on the disk. It’s something he’d need to prototype to be sure that our intended approach would actually work...