-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add error when specifying --output option for a solution #29065
Add error when specifying --output option for a solution #29065
Conversation
f929d42
to
fb98b97
Compare
8a768eb
to
32a7b0e
Compare
@@ -18,6 +18,25 @@ public static class OptionForwardingExtensions | |||
|
|||
public static ForwardedOption<T> ForwardAsSingle<T>(this ForwardedOption<T> option, Func<T, string> format) => option.SetForwardingFunction(format); | |||
|
|||
public static ForwardedOption<string> ForwardAsOutputPath(this ForwardedOption<string> option, string outputPropertyName, bool surroundWithDoubleQuotes = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VS appears to create a child folder for each project so this doesn't happen: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-change-the-build-output-directory?view=vs-2022#build-to-a-common-output-directory
If Visual Studio invokes the sdk with -o, It seems very possible that this breaks. We should verify that this doesn't break following the above document
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean. Visual Studio doesn't pass the -o
option. This PR is about what happens if you build a solution from the command line and specify that option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was thinking of some hypothetical implementation of VS that invoked an SDK CLI process with -o ./project-name/
, in which case this would break that. But that doesn't happen.
If appending projectName
to the -o values would be all it takes to implement the feature from the SDK side though, that would be pretty awesome
719eac0
to
9d3cd2d
Compare
.. with .sln files. Instead, pass `/p:PublishDir=..` to the build command. This changed in dotnet/sdk#29065, and broke `dotnet-runtime-perf` pipeline's blazor scenarios. ``` $ dotnet publish /home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln --configuration Release --output pub /p:NuGetPackageRoot=/home/helixbot/work/A8850905/w/A9A608EA/u/artifacts/packages/ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --framework net7.0 /p:_TrimmerDumpDependencies=true -bl:./traces/blazor_publish.binlog -p:WasmNativeWorkload=false MSBuild version 17.5.0-preview-22601-03+a2490dd3f for .NET /home/helixbot/work/A8850905/p/dotnet/sdk/8.0.100-alpha.1.22606.3/Current/SolutionFile/ImportAfter/Microsoft.NET.Sdk.Solution.targets(36,5): error NETSDK1194: The "--output" option isn't supported when building a solution. [/home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln] ```
.. with .sln files. Instead, pass `/p:PublishDir=..` to the build command. This changed in dotnet/sdk#29065, and broke `dotnet-runtime-perf` pipeline's blazor scenarios. ``` $ dotnet publish /home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln --configuration Release --output pub /p:NuGetPackageRoot=/home/helixbot/work/A8850905/w/A9A608EA/u/artifacts/packages/ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --framework net7.0 /p:_TrimmerDumpDependencies=true -bl:./traces/blazor_publish.binlog -p:WasmNativeWorkload=false MSBuild version 17.5.0-preview-22601-03+a2490dd3f for .NET /home/helixbot/work/A8850905/p/dotnet/sdk/8.0.100-alpha.1.22606.3/Current/SolutionFile/ImportAfter/Microsoft.NET.Sdk.Solution.targets(36,5): error NETSDK1194: The "--output" option isn't supported when building a solution. [/home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln] ```
.. with .sln files. Instead, pass `/p:PublishDir=..` to the build command. This changed in dotnet/sdk#29065, and broke `dotnet-runtime-perf` pipeline's blazor scenarios. ``` $ dotnet publish /home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln --configuration Release --output pub /p:NuGetPackageRoot=/home/helixbot/work/A8850905/w/A9A608EA/u/artifacts/packages/ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --framework net7.0 /p:_TrimmerDumpDependencies=true -bl:./traces/blazor_publish.binlog -p:WasmNativeWorkload=false MSBuild version 17.5.0-preview-22601-03+a2490dd3f for .NET /home/helixbot/work/A8850905/p/dotnet/sdk/8.0.100-alpha.1.22606.3/Current/SolutionFile/ImportAfter/Microsoft.NET.Sdk.Solution.targets(36,5): error NETSDK1194: The "--output" option isn't supported when building a solution. [/home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln] ``` Details: When building a solution, passing a relative path to `PublishDir` gets evaluated per-project. So, if we pass `-p:PublishDir=pub` then we get `pub/` sub-directories for each of the projects. But when used with `--output pub`, output for all the projects goes to the same directory. To have the same behavior use an absolute path.
…sh` (#2774) .. with .sln files. Instead, pass `/p:PublishDir=..` to the build command. This changed in dotnet/sdk#29065, and broke `dotnet-runtime-perf` pipeline's blazor scenarios. ``` $ dotnet publish /home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln --configuration Release --output pub /p:NuGetPackageRoot=/home/helixbot/work/A8850905/w/A9A608EA/u/artifacts/packages/ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --framework net7.0 /p:_TrimmerDumpDependencies=true -bl:./traces/blazor_publish.binlog -p:WasmNativeWorkload=false MSBuild version 17.5.0-preview-22601-03+a2490dd3f for .NET /home/helixbot/work/A8850905/p/dotnet/sdk/8.0.100-alpha.1.22606.3/Current/SolutionFile/ImportAfter/Microsoft.NET.Sdk.Solution.targets(36,5): error NETSDK1194: The "--output" option isn't supported when building a solution. [/home/helixbot/work/A8850905/p/performance/src/scenarios/blazorpizza/app/BlazingPizza.sln] ``` Details: When building a solution, passing a relative path to `PublishDir` gets evaluated per-project. So, if we pass `-p:PublishDir=pub` then we get `pub/` sub-directories for each of the projects. But when used with `--output pub`, output for all the projects goes to the same directory. To have the same behavior use an absolute path.
This seems to have broken |
Yeah, you have to specify a project: |
Too many my projects are broken when building nuget packaging with |
This has broken our build, thanks. @ctyar we're packing the whole solution not a single nupkg. Not sure why this has happened overnight but probabbly This is a breaking change it's not ok to release these on a patch version. |
Can confirmed --output works with 102 (pulled from repos locally), and is now broken with 200 (pulled by our Azure pipeline). (eventual consistency, ho!) |
That didn't even work, specifying the folder(s) I just get #20 3.922 /usr/share/dotnet/sdk/7.0.200/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(221,5): error NU5026: The file '...' to be packed was not found on disk. |
@dave-yotta for the install-scriptsnspecifically you can limit them to the 100 series if that's a requirement for you. For clarity, the 200 series is not a patch release from the 100-series of SDKs, it is a 'feature band' release where we do often introduce new features. The .NET SDK, and .Net overall, do not use SemVer for versions. While we do strive to make feature band' updates as painless as possible, we decided this work was worth doing, as we had seen many users end up with inconsistent builds due to the unclear semantics of publish/pack at the solution level. Now having said that, we should have had a breaking change notice up on the docs and missed that - that's 100% our fault and we'll get that updated today. |
I'm using net 7.0, I need the sdk to match that, without pulling any breaking changes. I would not have spotted anything in the docs because I'm referencing I have no way to "limit" to the 100 series, versioning tools do not support this - nor do your own install scripts. The only possible solution is to pick for example While I might be able to configure our dependency monitoring tooling to pick up docker FROM directives, there is no chance it'll pick up That leaves me in a situation where I will be lacking critical updates from at least the sdk install, which is likely worse than being left open to breaking changes all the time. see #30624 (comment) |
Can confirm this is breaking one of our builds as well. |
This is also breaking our build all of the sudden within Github Actions. We had a successful build a few days ago under MSBuild 17.4.1+9a89d02ff but now fails under MSBuild 17.5.0-preview-23061-01+040e2a90e We have a solution with multiple projects that all produce nuget packages. Here's the basic format of the dotnet Pack command we're running:
The build fails with: "error NETSDK1194: The "--output" option isn't supported when building a solution." Any recommendations on how we can change our build commands to build a solution and publish all the nuget packages to one place? |
For pack specifically you should be able to do a combination of |
To keep old behavior for
|
This is a pretty disappointing change. We've been publishing all of our projects in one go using Update: When using |
This change randomly broke our build system. Apparently the default SDK for GHA was .NET 6 where this option was working correctly and it is broken in .NET 7 which is default now. Why we cannot use the Update: As as read more about it, it's not even .NET 6 vs 7, it is 7.0.1 vs 7.0.200 - you cannot just break build system for a minor update. |
This is a breaking change and not a feature. |
This is really bad workaround. Pushing random nupkgs from all over the place to nuget? |
Hi @jozefizso - it should be possible to update to 7.0.201, where we've pushed out a hotfix that addresses this regression. Especially removing it from |
Fixes #15607