-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NETSDK1152 Microsoft.NET.Sdk.Web Library with package.lock.json during publishing #25294
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
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
It seems like Sdk.Web always exports |
Does sdk/src/RazorSdk/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props Lines 29 to 37 in 48cdb7a
sdk/src/WebSdk/Worker/Targets/Microsoft.NET.Sdk.Worker.props Lines 23 to 29 in 48cdb7a
If so, you could perhaps work around it by adding |
I tried adding the following <Project>
<PropertyGroup>
<DefaultExcludesInProjectFolder>$(DefaultExcludesInProjectFolder);packages.lock.json</DefaultExcludesInProjectFolder>
</PropertyGroup>
</Project> |
#24063 might be related. On .NET SDK 6, does it work if you set the DefaultItemExcludesInProjectFolder property instead? |
Yes! Using SDK 6.0.300 and the following <Project>
<PropertyGroup>
<DefaultItemExcludesInProjectFolder>$(DefaultItemExcludesInProjectFolder);packages.lock.json</DefaultItemExcludesInProjectFolder>
</PropertyGroup>
</Project> So is the answer here then that |
I think |
NuGet Team Triage: We're getting questions about this issue on the NuGet side as well: @marcpopMSFT |
@vijayrkn looks like this is being caused by the web sdk bringing in *.json which includes the package lock. Should the web sdk exclude or should we have a global exclude in the sdk to cover all cases? @dsplaisted |
We should have the path of the project-specific lockfile in the property |
I think the NuGetLockFilePath default is applied in the task, so it might need to be either NuGetLockFilePath if set, or packages.lock.json if it isn't. |
Excellent point - would it be possible to lift that defaulting up into the property logic in the future @nkolev92? |
Yeah, I think so. I can't imagine it'd break anything. |
Triage: Sounds like from baronfel that we're ok putting this in our SDK potentially as it's a general rule not to include that lock file. We can use the |
Created a tracking issue for using setting the msbuild property default in the targets file: NuGet/Home#13724. |
Describe the bug
Projects with
Sdk="Microsoft.NET.Sdk.Web
and<OutputType>Library</OutputType>
causesNETSDK1152
when publishing with package lock. In contrast toMicrosoft.NET.Sdk
a library withMicrosoft.NET.Sdk.Web
tries to copy thepackage.lock.json
file to all dependent projects. This causes issues if the dependent project also has a package lock file.This issue doesn't appear when just using
dotnet build
.Temporary workaround in dependency project:
To Reproduce
https://github.com/philipborg/Sdk.Web-PackageLock
Run
dotnet publish
on the example solution.Changing
Dependency.csproj
to<Project Sdk="Microsoft.NET.Sdk">
makes the project able to publish.Exception
C:\Program Files\dotnet\sdk\6.0.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Found multiple publish output files with the same relative path:
Further technical details
My local installation below.
The text was updated successfully, but these errors were encountered: