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

UPDATE (Works with one dash '-') Bundle-Migration: A positional parameter cannot be found that accepts argument '--force' #31218

Closed
JeepNL opened this issue Jul 10, 2023 · 13 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@JeepNL
Copy link

JeepNL commented Jul 10, 2023

  • Visual Studio Preview Latest (Version 17.7.0 Preview 2.0)
  • .NET & EF CORE 8 Preview 5

When I run the Bundle-Migration command in Visual Studio Package Manager Console with --force I'm getting the error below

Command:

PM> Bundle-Migration -SelfContained -TargetRuntime linux-x64 --force

Error:

Bundle-Migration : A positional parameter cannot be found that accepts argument '--force'.
At line:1 char:1
+ Bundle-Migration -SelfContained -TargetRuntime linux-x64 --force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Bundle-Migration], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Bundle-Migration
@JeepNL JeepNL changed the title Bundle-Migration: A positional parameter cannot be found that accepts argument '--force' UPDATE (Works with one dash '-') Bundle-Migration: A positional parameter cannot be found that accepts argument '--force' Jul 10, 2023
@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

Oops! It works with one dash '-', but there are two in the docs.

@JeepNL JeepNL closed this as completed Jul 10, 2023
@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 10, 2023

Are you looking at the correct docs??

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

Why would you think I'm looking at the wrong docs?

And the question without a link to the 'right' docs doesn't add much value IMHO.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 10, 2023

https://learn.microsoft.com/en-us/ef/core/cli/powershell#bundle-migration

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

Thank you!

https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#migration-bundle-example

Screenshot 2023-07-10 225543

Guess I should reopen this issue, 'cause other 'correct' docs give the wrong example.

@JeepNL JeepNL reopened this Jul 10, 2023
@ajcvickers
Copy link
Contributor

Guess I should reopen this issue, 'cause other 'correct' docs give the wrong example.

Can you post links to these docs so we can fix them?

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

I just did 😉

@ajcvickers
Copy link
Contributor

ajcvickers commented Jul 10, 2023

@JeepNL It's --force when using the Unix-like dotnet ef commands. It's -Force when using the PowerShell commands. (To be idiomatic to the platform.)

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

Okay, I didn't know that. But it was the only (-)-force example I saw in that page, so I started with double dashes.

Maybe it's an idea to add a -force example to 'Bundles' [Visual Studio] here: https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=vs#bundles

It was a bit confusing, but that's maybe my fault.

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

It is confusing, because a single dash and double dashes are used together here "Bundles" [.NET Core CLI]: https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#bundles

dotnet ef migrations bundle --self-contained -r linux-x64

[Oops Nr. 2, see next comment]
And at efbundle [options] there's no mention of '(-)-force' : https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli#efbundle

Screenshot 2023-07-10 231911

B.T.W. migration Bundles are awesome 🚀. I develop on Windows 11 w. Visual Studio but my project runs on a co-located Ubuntu 22.05 VPS and deploying DB changes is now a breeze!.

@JeepNL
Copy link
Author

JeepNL commented Jul 10, 2023

Oops! (Number 2) 'efbundle' is the executable itself. My bad.

@ajcvickers
Copy link
Contributor

@JeepNL So can this issue be closed?

@JeepNL
Copy link
Author

JeepNL commented Jul 11, 2023

Yes, sure.

I just wanted to point out that in docs about Migration Bundles the -force option isn't mentioned but --force is, which is clearly visible (frame with green background)

Windows is my main O/S. I'm only using Linux for publishing and running my web projects on my VPS. It's totally unclear to me when to use a single dash or double dashes. I know there's a difference between the O/Ss, but both use single and double dashes often.

dotnet --info works on both Windows and Linux.

So, when I couldn't get it to work with --force I created this issue. And just after that I searched for "A positional parameter cannot be found" in closed issues in this repo and I found this: #22390

After that I tried it with one dash and it worked, that's why I updated and closed this issue so soon after I created it. I felt stupid not to search in the closed issues and I don't want to waste your time, because you all are busy enough without me asking stupid questions / opening stupid issues.

I'm always a bit hesitant to create an issue, because I always think it's me who is doing something wrong. But I do think the docs would be better if there's an example with the -force argument.

There's another issue I encountered with Migration Bundles on Linux and that is when I publish it without -SelfContained and I try to run it on Ubuntu it complains that there's no framework. But .NET (SDK) is installed and working, I can compile the source code of my Hosted Blazor WASM / YARP / Web API projects on the VPS itself. A self contained efbundle executable is +/- 115MB and if it's not it's +/- 30MB, which uploads faster. But this could be because I'm doing something wrong, I'm good at that, doing things wrong. I don't want to waste your time and this already costed more than enough of your time.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2023
@ajcvickers ajcvickers added the closed-no-further-action The issue is closed and no further action is planned. label Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants