Short form /p:PropertName doesn't work in git bash on windows
See original GitHub issueSteps to reproduce
- Open
git bash
on windows - From
git bash
create new netstandard2.0 project:
mkdir ~/my-demo-lib
cd ~/my-demo-lib
dotnet new classlib
- Run any
dotnet
command with short version of msbuild property:/p:
. For example create a new NuGet package
dotnet pack /p:PackageVersion="1.0.0-dev"
Expected behavior
A new NuGet package should be created.
Actual behavior
Command fails with following output:
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: p:PackageVersion=1.0.0-dev
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.402
Commit: 3599f217f4
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.402\
Host (useful for support):
Version: 2.1.4
Commit: 85255dde3e
.NET Core SDKs installed:
2.1.2 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNe tCore.All]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNe tCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore. App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore. App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore. App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore. App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
git --version
output
git version 2.14.3.windows.1
Details
The issue occurs only on git bash
for windows. I was not able to reproduce it on windows cmd
or Linux bash
. Long form /property:
works as expected in git bash
. As suggested by @dasMulli short version in form -p:
works fine.
I’d say it is a small issue, but it creates troubles because the official documentations uses /p:
form. Probably it’s better to update documentation or mention that /p:
form doesn’t work on all platforms.
The issue was created as result of discussion in dotnet/sdk#8232
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Git-Bash Command Prompt won't open up after upgrading ...
I tried by reinstalling the git bash but re installation not works for me.it is due to the permission issue with the shell...
Read more >Getting Started with Git Bash Commands on Windows
In this tutorial, you'll learn about Git Bash commands, install Git Bash on Windows, and run some basic Git Bash commands in a...
Read more >Getting Python Shell To Work on Git Bash
This short post is for you. Getting Python IDLE to work on Git Bash might be a problem. Typing python into CMD or...
Read more >Getting Started with Git Bash | Tower Blog
A guide on how to install Git Bash and get up and running with Git!
Read more >What is Git Bash | Download a Terminal for Windows
Git bash is an application that provides a terminal for Windows. ... Git bash download and perform commands like how to open a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Your explication makes perfect sense! So, it is not dontnet cli issue and apparently not Cygwin - just
/p:
syntax has double meaning in context of Cygwin with msbuild.Probably documentation should be updated to use
-p:
syntax instead of/p:
to avoid confusions and because it works on all platforms.At least Google will index this page and hopefully people will find it easily.
As a conclusion, alternative syntax, which works on all platforms, are:
So on a windows machine now, Cygwin (at least in git bash configuration) is trying to convert
/p
toP:\
(drive letter logic) but fails on/p:
plus additional characters and will just pass the value without slash along. Thedotnet
program only getsp:Foo=Bar
without any slash and thus msbuild tries to parse it as a project file name (since no leading-
or/
). if there are more characters between/
and:
it passes the entire value along.Your best option at escaping is
But other a lot of other arguments won’t work as well.