-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Backslash in property gets converted to forward slash on Linux #3468
Comments
It's interesting that .NET Core MSBuild doesn't do the same thing: raines@raines-z220u:~$ msbuild bug.proj
Microsoft (R) Build Engine version 15.6.0.0 ( Thu May 10 14:00:26 UTC 2018) for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 7/2/2018 10:13:27 AM.
Project "/home/raines/bug.proj" on node 1 (default targets).
Build:
Regex=/(([^]]+)/)
Done Building Project "/home/raines/bug.proj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.22
raines@raines-z220u:~$ dotnet msbuild bug.proj
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Regex=\(([^]]+)\) @radical Do you recall anything that might explain this difference? |
This also seems to happen with the Exec task as well
I get the error:
Would be nice to have an attribute or something that turned off the replacement of backslashes. |
@radical any idea why this is happening only on our fork? |
Same problem on Mac. I have the following statement in my Xamarin.Android app:
The result should be:
But in fact it is:
Any workaround? My environment:Runtime:
|
I have related problem embedding resources:
Even after I call replace, it still / |
This is a huge issue also for me. Not sure why it is not addressed. For me, its either in the |
Anyone have a workaround? |
Yes @lonix1 Instead of using the inbuilt task(s) you can create your own task and use this one instead. Advantage here is that you can potentially customize / improve the flow even more. Disadvantage is the additional maintenance and complexity. |
Thanks for that nice workaround, I'm going to try it!
Agreed. This is a nasty bug. Who doesn't use linux for devops these days? Every time I encounter this bug, I resort to some hacky workaround. And scripts often fail and it takes me ages to debug the problem. Please attend to this, it's really a big one. Thanks! |
Workaround found! Use
|
I am having a similar issue. The "Dotnet test" call is being made in the CI/CD pipeline. And Azure DevOps is stripping the " no matter what I do. I don't think this is a \ problem here though, but a " problem. And this happens irrespective of windows or ubuntu machine. |
@tushargw This sounds like a different problem. I'd recommend opening a new issue for that (of course unless there's already a better fitting existing one). |
|
There's a bug/feature in msbuild for Linux which "helpfully" replaces backslashes with forward slashes while parsing project files. While in general this is useful for cross-platform compatibility with filenames, it is a major issue when using regular expressions or, indeed, any other situation in which a backslash is explicitly required. See : dotnet/msbuild#3468
There's a bug/feature in msbuild for Linux which "helpfully" replaces backslashes with forward slashes while parsing project files. While in general this is useful for cross-platform compatibility with filenames, it is a major issue when using regular expressions or, indeed, any other situation in which a backslash is explicitly required. See : dotnet/msbuild#3468
Just hit this bug again, and again spent almost a day on it. The No workaround other than a complete redesign. 😡 |
Hit this as well: vezel-dev/zig-sdk#121 Would really like to see a better answer to this than "write an inline task"... |
When a property contains backslashs in a project file, it will be converted to forward slashs when running with msbuild on Linux.
While this would be fine for paths (although one could just as well use forward slash in the project file since that works on both Windows and Linux), it causes problems when trying to set a regular expression in a property which requires a backslash to escape the next character.
Steps to reproduce
Project file
bug.proj
:Command line
Expected behavior
Outputs the line
Actual behavior
Outputs the line
Environment data
msbuild /version
output: 15.6.0.0Also happens with
xbuild
from older Mono versions.When building with
dotnet build -v d bug.proj
the output is as expected.OS Info:
Ubuntu 16.04.4 LTS
The text was updated successfully, but these errors were encountered: