-
Notifications
You must be signed in to change notification settings - Fork 10.3k
$(RepoRoot) is missing trailing slash so local builds fail #32615
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
Comments
@SteveSandersonMS Can you share the binlogs for the failing At the expense of being That Person(tm), I couldn't get a repro of this in a fresh sandbox against commit bc5960e. |
Sure, will email the binlog. One good way to see the problem in action is by evaluating the
Now the presence of this
... and removing it fixes it:
This problem didn't occur until recently - not sure what's changed! |
So, I tried two scenarios when validating this.
The Now, MSBuild does support referencing the value of an environment variable in the build. However, when both an environment variable and a build property share the same name, it is meant to favor the build property over the environment variable. Maybe the recent Arcade update brought in some differing behavior? In any case, although I can't repro it myself, I think it's probably a good hygiene measure to unset the |
We absolutely should not do anything w/ the Bash or Powershell |
/btw Build.proj hasn't changed since early January |
The When you build with
OK -- that makes sense to me. |
I'm starting to understand this:
Bottom line, my change in #32552 removed a fix for the "set but w/o a trailing slash" case and we're hitting that here. I don't get why @BrennanConroy this likely explains the SignalR failures as well as why I haven't seen that issue locally either. |
Taking this issue over. I'll fix it up in a new PR that reverts some of what I did in #32552 but limits the "can't override a global property" noise. |
@rainersigwald one question: Why is our root Directory.Build.props able to override Oops, meant to ask this in #32664 |
Not sure if this is a known issue yet, but it seems not to work to run
dotnet build
in almost any of the project directories undersrc/Components
. Most likely other projects will fail too.For some reason,
$(RepoRoot)
evaluates to a location without a trailing slash, even though code in the top-levelDirectory.Build.props
explicitly generates a value with a trailing slash. This makes many project references and<Import>
declarations fail to resolve correctly, since they assume there would be a trailing slash after$(RepoRoot)
. Also for some reason, this doesn't affectbuild.cmd
- perhaps it overrides the reporoot in some way.As a workaround, you can do
dotnet build /p:RepoRoot=C:\your\path\to\aspnetcore\
.Update
I tracked down the source of the bad value: it's the
build.cmd
scripts, as they set an environment variable calledRepoRoot
with the non-slash-ended value. Then the MSBuild logic only creates a value with a trailing slash if there isn't already a value, but there is already a value because of the env var.So the remaining question is: how did this ever work in the past? I see that
build.cmd
hasn't changed recently. One possible clue is this comment from the topDirectory.build.props
:<!-- $(RepoRoot) is normally set globally and Arcade overrides it to ensure a trailing slash. -->
Maybe Arcade no longer has this behavior of overriding it to ensure a trailing slash.
Older report
This seems to be a recent regression. Repro:
cd src\Components
git checkout main
git reset --hard
build.cmd
cd Samples\BlazorServerApp
dotnet build
Expected: builds the project
Actual: fails with errors like this:
Something to do with source generators, it appears.
The text was updated successfully, but these errors were encountered: