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
A simple library project targeting .NET Standard 2.0 and not meant to be packaged, therefore not setting the PackageId property, must set the IsPackable property to false, despite what's stated in Directory.Build.Targets:
<!-- The Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets unconditionally sets
PackageId=AssemblyName if no PackageId is provided, and then defaults IsPackable=true if
a PackageId is set (?!), meaning that by defaulteverythingis packable in Sdk-style
projects.
The Directory.Build.targets are imported after the user's project properties have been
read, and therefore gives us a chance to inspect if an explicit PackageId was provided,
before the NuGet SDK target is imported and defaults it. At this point, we can give
IsPackable a more sensible default, making it false if no PackageId was provided at this
point.-->
If IsPackable is not set to anything in the project file, Visual Studio will go into an infinite loop, triggering a design-time build of the project approximately every 2 seconds.
From what I have observed, the evaluated value of IsPackable in these design-time builds alternates between true and false (true in one build, false in the following one, repeat ad libitum).
Steps to Reproduce
Create a new Library project. No code necessary. Do not set IsPackable. Watch Visual Studio go crazy.
Expected Behavior
Visual Studio should not repeatedly trigger design-time builds for no reason.
Seems to be only triggered when the version is dynamic, no? Because these targets set these locally to a hardcoded 42.42.42 value 🤔 . I'm puzzled since I looked at the SDK targets in order to add this, and I never experienced this issue myself, and in all projects I use these targets in, I never set IsPackable (i.e. a trivial one at https://github.com/devlooped/web/blob/main/src/Tests/Tests.csproj).
Describe the Bug
A simple library project targeting .NET Standard 2.0 and not meant to be packaged, therefore not setting the
PackageId
property, must set theIsPackable
property tofalse
, despite what's stated inDirectory.Build.Targets
:If
IsPackable
is not set to anything in the project file, Visual Studio will go into an infinite loop, triggering a design-time build of the project approximately every 2 seconds.From what I have observed, the evaluated value of
IsPackable
in these design-time builds alternates betweentrue
andfalse
(true
in one build,false
in the following one, repeat ad libitum).Steps to Reproduce
Create a new Library project. No code necessary. Do not set
IsPackable
. Watch Visual Studio go crazy.Expected Behavior
Visual Studio should not repeatedly trigger design-time builds for no reason.
Version Info
Bug observed adding a project to https://github.com/devlooped/ThisAssembly v1.0.9, using VS2022 v17.2.1
Additional Info
The text was updated successfully, but these errors were encountered: