Fix PublishDepsFilePath setting#11462
Conversation
Restore the semantics of PublishDepsFilePath to be location where the deps.json resides when published. The PublishDepsFilePath property is used by external projects (ex: asp.net) which rely on this definition. PublishDepsFilePath is empty (by default) for PublishSingleFile, since the deps.json file is embedde within the single-file bundle. Add a test case for this property.
dougbu
left a comment
There was a problem hiding this comment.
Works for me but this is @dsplaisted's parade
|
What would the guidance be for consumers of this property if they are run for a single file app? This change looks like it fixes ASP.NET because it reverts to the previous behavior for a non-single-file app. But if there's a target that wants to rewrite the deps file and it should work for single-file apps, what are they supposed to do? |
|
Hmm, @dsplaisted would it work to restore the previous (never-empty) values of |
If the meaning of "PublishDepsFilePath" is really the "actual published location" of the deps file, there's no such location in single-file bundle -- because the deps.json is embedded within the single-file bundle. Therefore, this property is unset for single-file apps. This behavior is similar to other location semantics in single-file apps. For example, If a target wants to modify the deps file, it needs to insert itself between |
I don't think this is a good idea -- because |
|
@dsplaisted : Made the |
|
From my perspective, the current meaning of I vote against requiring the world to use a new property instead of |
|
@dougbu we only need to use I think using I'm wary of keeping |
|
@swaroop-sridhar understand your wariness. I lean toward avoiding breaking changes and you're leaning toward easily explainable general rules. The reason for my leaning is mainly that nobody reads the general rules. But my thoughts on single-file publish are theoretical -- I don't use that infrastructure. If And, if this also fixes the new NU5118 warnings, all the better. |
|
My suggestion is to take this fix, and unblock the SDK update. |
|
Can we please reach consensus here as this currently blocks both aspnetcore and arcade updating to a newer sdk. For aspnetcore this is even on the critical path for preview4. |
|
@dsplaisted please review. |
|
|
||
| <PropertyGroup> | ||
| <PublishDepsFilePath Condition=" '$(PublishDepsFilePath)' == ''">$(IntermediateOutputPath)$(ProjectDepsFileName)</PublishDepsFilePath> | ||
| <!-- _DepsPath is the location where the deps.json file is originally created |
There was a problem hiding this comment.
Looks like this comment is out of date with the current code. I don't see a _DepsPath property.
| var publishDepsFilePath = GetPropertyValue(projectPath, targetFramework, "PublishDepsFilePath"); | ||
| var expectedDepsFilePath = $"{publishDir}{projectDepsFileName}"; | ||
|
|
||
| publishDepsFilePath.Equals(expectedDepsFilePath).Should().BeTrue(); |
There was a problem hiding this comment.
I think it's better to write the assertion like this:
publishDepsFilePath.Should().Be(expectedDepsFilePath)That gives more diagnosable failure messages.
(This also applies to the other assertions)
| { | ||
| var testProject = SetupProject(singleFile: false); | ||
| var testAsset = _testAssetsManager.CreateTestProject(testProject); | ||
| var restoreCommand = new RestoreCommand(Log, testAsset.Path, testProject.Name); |
There was a problem hiding this comment.
I think you can remove the explicit restore commands. The GetValuesCommand should restore by default for you.
|
Looks good, we can take this change. I did not think it was blocking for taking an updated SDK, I thought that there was a workaround. |
It's possible to create a workaround but I don't have one yet. And, if this is also at the root of the new NU5118 warnings, the only workaround there is to suppress the warnings i.e. to sweep things under the rug. |
|
Thanks @swaroop-sridhar and @dsplaisted. About how much time will likely pass between this merge and a new SDK version that dotnet-install.ps1 / dotnet-install.sh can install? |
|
Better question: Is completion of https://dev.azure.com/dnceng/internal/_build/results?buildId=624059&view=results plus ~15 minutes enough for this fix to be available? |
|
@dougbu, no, once that build completes then it needs to get inserted into the installer repo (which is automated, though it sometimes needs manual intervention). Here's the most recent PR that updated the SDK in installer: dotnet/installer#7351 |
|
Ah, then https://dev.azure.com/dnceng/internal/_build/results?buildId=624059 completion (soon) + ~15 minutes for Maestro++ machinations + ~2 hours for a dotnet/installer PR and a https://dev.azure.com/dnceng/internal/_build?definitionId=286 run + another ~15 minutes i.e. likely 2.5 hours from now (best case)? |
|
Never mind, the current pipeline just failed in the (Arcade) Signing validation step: https://dev.azure.com/dnceng/internal/_build/results?buildId=624059&view=logs&j=0a6c679f-72be-5867-422e-acb741a068a3&t=d8e44ddf-8ea2-5518-25e7-4300471a271a&l=20 More waiting |
|
(@dsplaisted @swaroop-sridhar the 'master' branch of dotnet/sdk started failing after an update from microsoft/msbuild. I don't see this error before https://dev.azure.com/dnceng/internal/_build/results?buildId=622370&view=logs&j=0a6c679f-72be-5867-422e-acb741a068a3&t=d8e44ddf-8ea2-5518-25e7-4300471a271a&l=20) |
Restore the semantics of PublishDepsFilePath to be location where the deps.json resides when published.
The PublishDepsFilePath property is used by external projects (ex: asp.net) which rely on this definition.
PublishDepsFilePath is empty (by default) for PublishSingleFile, since the deps.json file is embedde within the single-file bundle.
Add a test case for this property.