Closed flcdrg closed 1 month ago
A temporary workaround is to add this to the .csproj file:
<Content Remove="packages.lock.json" />
@javiercn is this something that StaticWebAssets controls, or should we ping Vijay?
Ping @javiercn
@mkArtakMSFT @wtgodbe this isn't us, as the packages.lock.json is not inside the wwwroot
folder.
@vijayrkn any thoughts?
The fix is likely https://github.com/dotnet/sdk/blob/f6c64dcc881dbda28db6747d83ab061c8713582d/src/StaticWebAssetsSdk/Sdk/Sdk.StaticWebAssets.StaticAssets.ProjectSystem.props#L4 (This is shared between the Web SDK and us because of layering)
@javiercn do you mean this is already fixed by a change that you've done?
Is there an existing issue for this?
Describe the bug
Given an ASP.NET web project where the csproj has
Sdk="Microsoft.NET.Sdk.Web"
, then if that project uses a NuGet lockfile, then the lockfile is also copied to the output directory when the project is built.Expected Behavior
packages.lock.json
should not be copied to the output directory.It isn't copied to the output directory for projects that use Microsoft.NET.Sdk
This may have the potential to confuse build pipeline caching tasks as they often use wildcards to locate packages.lock.json across a solution, and this bug causes extra files to match. eg. the Azure Pipelines cache task considers this a 'cache miss' as the extra packages.lock.json files are noticed after the build has completed.
Steps To Reproduce
dotnet new web
dotnet build /p:RestorePackagesWithLockFile=True
Note that
packages.lock.json
is now present in the bin/Debug/net8.0 output directoryExceptions (if any)
No response
.NET Version
8.0.202
Anything else?
No response