-
Notifications
You must be signed in to change notification settings - Fork 588
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
MSBuild property escaping is invalid #2392
Comments
I don’t get it. As far as I can see we only escape the official msbuild special characters. And ‘\’ is not one of them?
|
Ah we escape ‘\’ in master and I think the reason is in fact the test. |
Yeah I think i'll find a way to test every character somehow (at least ascii range) and see what sticks |
So after tests with something like that : <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" />
<Target Name="Build">
<Message Text="__BEFORE__$(Arg)__AFTER__" />
<WixAssignCulture />
</Target>
</Project> My conclusion is that msbuild argument handling is Fucked Up Beyond All Repair. Escaping arguments with After tests the minimum for the parameters to escape are Fun thing is that the Anyway I'll PR limiting the list to only the 2 necessary ones it's good enough for now. |
Yes I'm open for suggestions/prs maybe we need to open an issue in msbuild? |
It's not a perfect solution but it will already solve the biggest problem (paths) Fixes fsprojects#2392
Tried a few things but I don't see any way forward dotnet/msbuild#885 (comment) say this bug is by design and there is no way to avoid it hat is fully cross platform and future-proof. 2 solutions for others:
|
Description
Essentially the fix of #2112 has been a too broad I think. Properties passed to MSBuild command line need
;
to be escaped as it's a list of properties separated by;
but after e7e9c10 it's also escaping other things like\\
but MSBuild doesn't support that at all ending up with an invalid command line when a property contains a path for example.Repro steps + Expected & Actual behavior
Pass any path as a property to msbuild, for example to call Wix trying to generate
/p:WixTargetsPath=c:\Code\packages\build\WiX\tools\wix.targets
by you'll get/p:WixTargetsPath=c:%5CCode%5Cpackages%5Cbuild%5CWiX%5Ctools%5Cwix.targets
Known workarounds
Copy paste MSBuild.fs in your project and keep only
;
being escaped in propertiesRelated information
The text was updated successfully, but these errors were encountered: