Incorrect PowerShell Build Command for .NET Project

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 7 comments · opened Feb 24, 2025 · closed Feb 24, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
When I try to get claude to build a dotnet project, it issues a command pwsh -n -C 'dotnet build'. It seems the -n parameter is causing issues, and powershell always returns a 128 exit code.

Environment Info

  • Platform: macos
  • Terminal: iTerm.app
  • Version: 0.2.9
  • Feedback ID: 5cc6149d-20e9-4291-a158-63cf44fc7cdf
  • Shell: Powershell (pwsh)

View original on GitHub ↗

7 Comments

david-jarman · 1 year ago

Here is what it looks like when I ask Claude Code to build my repo
!Image

bcherny collaborator · 1 year ago

Can you share the correct bash command that you would have expected Claude to run?

david-jarman · 1 year ago

pwsh -c 'dotnet build'

AFAIK, the -n option is not valid for powershell and I don't know where it's coming from. about_Pwsh

wolffiex collaborator · 1 year ago

It sounds like Claude just doesn't know a lot about pwsh. One thing that can help in situations like this is to make the relevant documentation available to claude somewhere in your repo. Another possibility is to sync the relevant github repo for the library you are using. If it's a matter of reminding Claude how to do common things (like build or run tests) add a CLAUDE.md file to your repo. Claude Code can get you started with this if you go /init

david-jarman · 1 year ago

I will try adding some instructions to the CLAUDE.md later and test. I suspect it may have to do with the fact that I'm using pwsh as the host shell for claude code. I just checked the official documentation and it says it only officially supports bash and zsh, so maybe if I try the project with zsh as the host, maybe it will work as intended.

david-jarman · 1 year ago

I ran the same command but used bash to start claude, and now the dotnet build commands work. I'll close out this issue as powershell is not officially supported.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.