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
We have an SDK-compatible mechanism for packing .NET tools: PackAsTool. This satisfies a very specific scenario for .NET tools, but doesn't work for regular CLI tools that don't need packing as standalone dotnet tools.
For these CLI tools, packing the output of Publish makes much more sense, and results in way fewer customizations in package references.
We introduce a new property, PackAsPublish, which is initialized to `true` whenever the project is publishable and a cross-platform executable (pending widening the definition upon feedback). In this case, we don't infer content from package dependencies and references with copy local and so on, but rather rely exclusively on Publish doing its work. We don't change the PackFolder treatment, so that property is orthogonal to PackAsPublish, although it's likely `tools` will be the most commonly used folder.
The property's default `true` value is calculated dynamically in an initial target since we need to inspect `ProjectCapability` which is set by the SDK to include `CrossPlatformExecutable`. This is the more extensible approach, rather than checking the output type ourselves.
<ErrorCode="NG1004"Condition="'$(PackAsTool)' == 'true' and '$(PackAsPublish)' == 'true'"Text="PackAsTool and PackAsPublish are mutually exclusive." />
251
252
252
253
<!-- Even if all these conditions are false, the user can still explicitly pack the file, of course -->
253
254
<ItemGroupLabel="Readme"Condition="'$(PackReadme)' == 'true' and '$(PackageReadmeFile)' != '' and '$(IsPackable)' == 'true'">
@@ -294,7 +295,7 @@ Copyright (c) .NET Foundation. All rights reserved.
0 commit comments