Unable to run Microsoft Upgrade assistant

479 views
Skip to first unread message

nitesh...@gmail.com

unread,
Sep 13, 2023, 7:25:33 AM9/13/23
to go-cd
Hi team,

I am trying to run Microsoft upgrade assistant but its failing with below error
Same command i am running through command prompt, it works as expected.

i am running that it in non-interative mode so that microsoft upgrade assistant doesn't wait for user input on console. however running with GOCD task it still wait for user input and failing

can you please help me with that


[go] Task: cmd /c "upgrade-assistant.exe upgrade D:\Upgrade\GOPIPE\WEBAPP\SampleAPI\SampleEfAPI.csproj --operation Inplace --targetFramework net6.0 --non-interactive"

Initializing and loading extensions...
Telemetry
Upgrade Assistant collects usage data in order to help us improve your
experience. The data is collected by Microsoft and shared with the community.
You can opt-out of telemetry by setting the
DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT environment variable to '1' or 'true'
using your favorite shell.
Read more about Upgrade Assistant telemetry:
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
Press any key to continue...
System.InvalidOperationException: Cannot read keys when either application does
not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at
Microsoft.UpgradeAssistant.Cli.Startup.FirstUseStartup.StartupAsync(Cancellation
Token cancellationToken) in
D:\a\_work\1\s\src\Experiments\UpgradeAssistant\cli\Startup\FirstUseStartup.cs:l
ine 37
at
Microsoft.UpgradeAssistant.Cli.Flow.Steps.Upgrade.StartupFlowStep.ValidateUserIn
putAsync(IFlowContext context, CancellationToken cancellationToken) in
D:\a\_work\1\s\src\Experiments\UpgradeAssistant\cli\Flow\Steps\Startup\StartupFl
owStep .cs:line 34
at Spectre.Console.Flow.FlowRunner.RunAsync(CancellationToken
cancellationToken) in
D:\a\_work\1\s\src\Experiments\UpgradeAssistant\spectre.flow\Flow\FlowRunner.cs:
line 83

Ashwanth Kumar

unread,
Sep 13, 2023, 6:35:33 PM9/13/23
to go...@googlegroups.com
Maybe try adding, "DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT" environment variable to "1"?





--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/007cd4c6-639a-430f-bf49-53d6649b22d5n%40googlegroups.com.


--

Ashwanth Kumar / ashwanthkumar.in

Nitesh Kumar

unread,
Sep 14, 2023, 12:41:24 PM9/14/23
to go...@googlegroups.com
Hi Aswanth,

I have tried this option but no luck. can you pleas suggest anything else



--
Thanks&Regards

Nitesh kumar

Nitesh Kumar

unread,
Sep 15, 2023, 5:58:42 AM9/15/23
to go...@googlegroups.com
Hi Team,

Any help will be much appreciated. looking forward to hearing from you.
--
Thanks&Regards

Nitesh kumar

Chad Wilson

unread,
Sep 15, 2023, 6:09:41 AM9/15/23
to go...@googlegroups.com
Which GoCD version are you using?

Can you share a screenshot from your task configuration? e.g something like the below

image.png


Generally speaking you shouldn't need to do a "cmd /c" yourself, as GoCD does this implicitly and it's possible doing this might be causing something to go wrong with the arguments parsing/quoting. Just a guess though.

Try configuring the task without it, e.g something like the below.

command:
upgrade-assistant.exe
arguments:

upgrade
D:\Upgrade\GOPIPE\WEBAPP\SampleAPI\SampleEfAPI.csproj
--operation
Inplace
--targetFramework
net6.0
--non-interactive

-Chad

Nitesh Kumar

unread,
Sep 15, 2023, 1:09:37 PM9/15/23
to go...@googlegroups.com
image.pngimage.png

Hi Chad,

i have in the same way you have suggested but looks same issue..



--
Thanks&Regards

Nitesh kumar

Chad Wilson

unread,
Sep 15, 2023, 7:49:41 PM9/15/23
to go...@googlegroups.com
You seem to have missed all the additional arguments (one per line). --non-interactive is presumably the most important to get the behaviour you want?

Sriram Narayanan

unread,
Sep 15, 2023, 8:51:29 PM9/15/23
to go...@googlegroups.com
I suggest running the command via a batch file and achieving non-interactivity. Once that is achieved, add the batch file to a repository, set it as a material to this pipeline, and then run the batch file as a task.

Advantages:
- version controlled scripts
- test outside of the orchestrator first
- predictable and controllable experiment within the script ( you get to see the environment variables within the script and also pass via GoCD’s environment variable feature).

— Sriram 


Ashwanth Kumar

unread,
Sep 15, 2023, 10:21:10 PM9/15/23
to go...@googlegroups.com
I think the main problem of the OP is that the upgrade-assistant is not running in non-interactive mode. According to the docs, the first time experience always shows the telemetry message, I think his agents are elastic so the first time experience is happening each time. 

The environment variable is the only documented approach but for some reason he says it ain't working.

Nitesh, can you share the environment variable configurations on gocd?

Thanks,


Chad Wilson

unread,
Sep 16, 2023, 2:04:59 AM9/16/23
to go...@googlegroups.com
Yes, however normally such features should respect a --non-interactive flag, print the message and move on rather than pausing.

I inferred that the flag wasn't being seen by the tool due to a possible args parsing problem (there is a long history of such issues in GoCD largely fixed in 22.2.0 to my knowledge and cmd has truly bizarre behaviour at times. Depending on the exact task configuration, in older versions of GoCD whitespace can end up being important, especially with nested cmd commands.

I suppose it's possible that --non-interactive is applied to the upgrade sub-command behaviour but not the generic telemetry though (as poor an implementation choice as this would be by Microsoft), so probably worth ensuring the telemetry opt-out is configured correctly to remove that as a reason.

-Chad

Nitesh Kumar

unread,
Sep 16, 2023, 4:08:12 AM9/16/23
to go...@googlegroups.com
Hi Chad,

I did all as but same issues

Nitesh Kumar

unread,
Sep 16, 2023, 5:24:24 AM9/16/23
to go...@googlegroups.com
Hi Aswanth.

please find attached env variables
image.png
image.png

Hi Sriram,

I have also tried using batch script but that got failed with same reason.
--
Thanks&Regards

Nitesh kumar

Chad Wilson

unread,
Sep 16, 2023, 5:41:27 AM9/16/23
to go...@googlegroups.com
Any difference if you also set env var DOTNET_UPGRADEASSISTANT_SKIP_FIRST_TIME_EXPERIENCE to 1 (also documented at https://learn.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-telemetry?tabs=console#disclosure )?

Other than that, you are cropping off important information such as the full args you are using with the way you are including screenshots of config/output. This makes it very difficult to understand what is going on as others can't correlate the specific inputs you are setting with the specific and full logs/output you are seeing for each test you run. Consider trying to ensure input and output is complete, or that output comes from full raw logs (which you can redact text of rather than cropped screenshots).

-Chad

Nitesh Kumar

unread,
Sep 16, 2023, 9:42:32 AM9/16/23
to go...@googlegroups.com
Hi Chad

yes tried with that env variable too but same result.

please find attached complete log and screenshot from console.

image.png



--
Thanks&Regards

Nitesh kumar
completelog.txt

Chad Wilson

unread,
Sep 16, 2023, 10:01:36 AM9/16/23
to go...@googlegroups.com
The log you attached doesn't show DOTNET_UPGRADEASSISTANT_SKIP_FIRST_TIME_EXPERIENCE being set, it only includes DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT.

Are you sure you set both correctly?

Nitesh Kumar

unread,
Sep 16, 2023, 10:14:05 AM9/16/23
to go...@googlegroups.com
Hi Chad,

i attached again logs with that env variable too.



--
Thanks&Regards

Nitesh kumar
newcompletelog.txt

Chad Wilson

unread,
Sep 16, 2023, 10:40:51 AM9/16/23
to go...@googlegroups.com
I'm not sure. This seems like a problem specific to the tool rather than GoCD, but I do not have a way to replicate as I only have a Windows 11 ARM64 Preview virtual machine easily available, and it seems too much of a hassle to get the tooling working on arm64 right now (I tried, it didn't install correctly).

I'd suggest you see if the env vars work when running directly/locally in a clean environment, and/or ensure you have the correct/latest version of the upgrade-assistant tool installed which is consistent with the docs versions. It seems they completely rewrote it for 0.5 and didn't clean up the documentation so perhaps there are problems if this is the version you are using.

If you are using 0.5 you could look at doing something like https://github.com/dotnet/upgrade-assistant/issues/1497#issuecomment-1620790136 to downgrade and see if it works with 0.4.421302

It's worth noting that at https://github.com/dotnet/upgrade-assistant#usage seems to generally advise against non-interactive mode. Maybe you can also try adding --non-interactive-wait 1 and see if that changes anything.

Nitesh Kumar

unread,
Sep 16, 2023, 10:51:33 AM9/16/23
to go...@googlegroups.com
Hi Chad,

Thanks for getting back to me so quickly.

An interesting point is if we park GOCD for a moment and run the upgrade assistant command through command prompt it works perfectly fine so the point to be noted here is when we will execute the complete command the console of the command prompt get clear and start from the top with upgrade assistant specific information,  I am just wondering if it is opening a different command prompt?

I mean , if you want you can easily install the upgrade assistant from the dot dotnet tool command in your machine and try running the command you will see what I am trying to explain to you.

Nitesh Kumar

unread,
Sep 18, 2023, 6:02:22 AM9/18/23
to go...@googlegroups.com
Hi Chad/Everyone,

Is that something we can do on this ?
--
Thanks&Regards

Nitesh kumar

Sriram Narayanan

unread,
Sep 18, 2023, 11:27:04 AM9/18/23
to go...@googlegroups.com
Could you confirm that when you run via just a batch file then there is no waiting on the input?

What happens if you use this batch file as a material and run it?

Set the environment variable within the batch file.

— Sriram

Nitesh Kumar

unread,
Sep 19, 2023, 5:13:50 AM9/19/23
to go...@googlegroups.com
Hi Sriram,

Have tried looking these options and end up with same result 

Reply all
Reply to author
Forward
0 new messages