Skip to content
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

Build fails when using sdk version 7.0.200 #30625

Closed
GregorLamche opened this issue Feb 15, 2023 · 28 comments
Closed

Build fails when using sdk version 7.0.200 #30625

GregorLamche opened this issue Feb 15, 2023 · 28 comments
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@GregorLamche
Copy link

GregorLamche commented Feb 15, 2023

Describe the bug

Project fails to build when the sdk version 7.0.200 is used:

error NETSDK1194: The "--output" option isn't supported when building a solution.

Works fine with version 7.0.102 however.

To Reproduce

apt-get update
apt-get install -y --no-install-recommends dotnet-sdk-7.0 //<-- may or may not actually install version 7.0.200 depending on used source repos, Azure Pipeline pulls 200
dotnet restore "service.sln"
dotnet build "service.sln" -c Release -o /app/build --no-restore

We may close this issue if:

  • the repro project you share with us is complex. We can't investigate custom projects, so don't point us to such, please.
  • if we will not be able to repro the behavior you're reporting
    -->

Exceptions (if any)

error NETSDK1194: The "--output" option isn't supported when building a solution.

Workaround

Downgrade to previous package:

apt-get install -y dotnet-sdk-7.0=7.0.103-1 

This however breaks testing, and is not a solution.

Further technical details

  • ASP.Net service
  • Ubuntu Docker base image
  • fails in Azure Pipeline
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Feb 15, 2023
@KalleOlaviNiemitalo
Copy link

The NETSDK1194 error was intentionally added in #29065, to fix #15607.

It hasn't yet been documented at .NET SDK error list, though. Perhaps it should be added to Breaking changes in .NET 7, too.

@GregorLamche
Copy link
Author

I was under the impression that 7.0 was already out of the preview phase.
Yes, this is a breaking change, and needs to be listed.

@GregorLamche
Copy link
Author

Updated description with building project workaround.
This however breaks testing in turn and is not an acceptable solution, unless cascading workarounds.

@KalleOlaviNiemitalo
Copy link

Can you use .NET SDK 7.0.103 for now? It does not include this change.

@GregorLamche
Copy link
Author

Yes, updated issues with package downgrade workaround.

@KalleOlaviNiemitalo
Copy link

I mean, both .NET SDK 7.0.103 and 7.0.200 include the fix for CVE-2023-21808 – .NET Remote Code Execution Vulnerability, so 7.0.103 would be safer than 7.0.102.

@xavierjohn
Copy link

.NET SDK 7.0.103 works for me but 7.0.200 fails.
https://github.com/xavierjohn/FunctionalDDD/actions/runs/4179702217/jobs/7240030706

@buvinghausen
Copy link

Just bizarro land that you would merge in a breaking change for something that has literally worked without issue for almost 6 years at this point.....

@baronfel
Copy link
Member

There's a follow up on this situation here.

@Matthewsre
Copy link

This just broke a few of my GitHub Actions using dotnet pack

dotnet pack src/Service.Extensions.Public.slnf -p:PackageVersion=$VERSION -c Release --output nupkgs

Still should be working according to the docs:

https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack

image

Then stumbled across this issue :(

@Shane32
Copy link

Shane32 commented Feb 16, 2023

Based on #15607, NETSDK1194 was added to prevent building multiple solutions into a single folder. In my case, there is a bug and regression here, because I am not building to a single folder - in fact my CI script explicitly says --no-build. However, the error is being applied to dotnet pack when it should not be. Note that the --output option for dotnet pack does not affect the solution build target directory even if --no-build was not specified. I require all solutions to be packed into a single folder so that I can upload them all to NuGet in a single step. I'm sure this is common for anyone that is packing multiple projects together for NuGet, as it is the only logical way to construct the CI script. Please make a patch available asap. Until then I will need to stay on 7.0.103.

cc: @sungam3r

@altso
Copy link

altso commented Feb 16, 2023

FYI, --output could replaced with -p:PackageOutputPath={path} in dotnet pack command.

@Shane32
Copy link

Shane32 commented Feb 16, 2023

I will attempt to use the dotnet pack --property:PackageOutputPath=DESIRED_PATH solution before downgrading as listed in #30624 (comment) . The documentation listed there MUST be included in the official documentation if there is to be a change. Currently, and I quote, it says "Places the built packages in the directory specified.". Note specifically that "packages" is plural. There is nothing to indicate that a solution cannot be built.

Having the functionality to place all built packages in a single folder is a necessity!!!

@baronfel
Copy link
Member

@Shane32 agree on all counts. A few notes:

  • docs PRs have been made and are awaiting merge
  • the fixed version (which has been merged and will release next month) will not apply to pack at all, exactly for the reasons you give

@buvinghausen
Copy link

buvinghausen commented Feb 17, 2023

I just put the following line in Directory.Build.props for my nuget solution and it works just fine

<PackageOutputPath>..\..\</PackageOutputPath>

From there you can wildcard push...

dotnet nuget push "*.nupkg"

Note: this hoists the packages up from the \src\{Project} folder to the solution root. Obviously your folder structure may vary.

@renemadsen
Copy link

  • the fixed version (which has been merged and will release next month) will not apply to pack at all, exactly for the reasons you give

When in next month?

We have a lot of nuget packages, where the CI/CD is broken now due to this issue, so would be nice to know if we should spend time change all processes to use the --property:PackageOutputPath instead of --output or we can live with waiting for it to be released.

@marcpopMSFT
Copy link
Member

#30624 (comment)

@Den4ikzxcv
Copy link

Den4ikzxcv commented Feb 18, 2023

We faced the same problem with dotnet pack.
We fixed it by searching for needed .csproj file:

was before:
dotnet pack --configuration Release /p:Version=${VERSION} --no-build --output .
now:
dotnet pack **/Your.Project.csproj --configuration Release /p:Version=${VERSION} --no-build --output .

@sungam3r
Copy link

Agree with #30625 (comment) . We intentionally use --no-build and --no-restore in the pack command.

the fixed version (which has been merged and will release next month) will not apply to pack at all, exactly for the reasons you give

@baronfel 👍

@EvilVir
Copy link

EvilVir commented Feb 22, 2023

Do I understand correctly that you removed the very useful and important feature, that allowed flexibility, because some random guys had overwritten their files with it? And you did that in stable, production ready release?

Are you serious? What’s wrong with defining the output path? Those for whom solution wide output doesn’t work should reach for workarounds (like building each project separately and into different folder or not using —output flag), not everyone else!

There are tools and pipelines built around this flag, this is well known and expected behavior. If someone blames own misconfiguration on optional flag, then flag alone is least of their problems.

Please bring back original functionality.

AlienDwarf referenced this issue in AlienDwarf/open-meteo-dotnet Feb 23, 2023
@spiko-md
Copy link

spiko-md commented Feb 24, 2023

because some random guys had overwritten their files with it?

There seems to be some other reasoning behind it, but I agree, IMO this is a breaking change and should go to a major version.

https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/7.0/solution-level-output-no-longer-valid

@EvilVir
Copy link

EvilVir commented Feb 24, 2023

There seems to be some other reasoning behind it

Reasoning is that „behavior is inconsistent”. Yeah, maybe it is but it’s well known fact, been there forever and that „inconsistency” was tamed by many and incorporated into the tools.

Just look at this topic - I bet my comment alone got more likes than there were people for whom that „inconsistency” was a problem and not desired behavior.

So it’s solution for few that became now new issue for many. Another good design choice .NET team! Whooohooo!

Anyway thank you for linking that article. After all that blablabla justifying this stupid change there’s at least list of options provided, that we all now can try to use to bring our tools back to life.

@baronfel
Copy link
Member

@EvilVir you're entirely correct, we should not have introduced the change at this severity in this version. Please bear with us, as we're in the process of releasing the 7.0.201 hotfix, as mentioned in #30624 (comment).

@baronfel
Copy link
Member

Hello folks, wanted to give you all an update on the situation.

Last night, 7.0.201 was released through all the various channels. It should already be available on GitHub Actions and AzDO runners, and of course for local installation. This hotfix contained the changes to the --output parameter mentioned above: it is downgraded to a warning, and the check no longer applies to the pack command.

The other problem logged in this issue, MSBuild logging a prerelease version string, will be handled in the normal servicing schedule - likely with next month's expected release of 7.0.202.

Thank you all for the feedback and discussion on this issue.

@Shane32
Copy link

Shane32 commented Feb 25, 2023

Thanks! So far GitHub Actions' actions/setup-dotnet with 7.0.x still won't pull 7.0.201 unfortunately -- at least, not for me.

@EvilVir
Copy link

EvilVir commented Feb 26, 2023

All got back to normal on my end. Thank you!

@stunney
Copy link

stunney commented Feb 28, 2023

This issue is ALSO happening for 6.0.* builds:
dotnet/core#8245

@Shane32
Copy link

Shane32 commented Mar 9, 2023

Last night, 7.0.201 was released through all the various channels.

All URLs for 7.0 were not properly updated - see here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests