Skip to content
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 /p:OutputPath is not being set with a trailing backlash #869

Closed
Cawifre opened this issue Jul 17, 2015 · 6 comments
Closed

MSBuild /p:OutputPath is not being set with a trailing backlash #869

Cawifre opened this issue Jul 17, 2015 · 6 comments

Comments

@Cawifre
Copy link

Cawifre commented Jul 17, 2015

As of commit 5377573, the OutputPath parameter shifted from being guaranteed to always have a trailing backslash to being guaranteed to never have a trailing backslash.

Microsoft.Common.CurrentVersion.targets expects $(OutputPath) and $(OutDir) to have trailing backslashes to allow for concatenation. It attempts to make sure that a trailing backslash is added, but setting a property on the command line circumvents these attempts.

This causes issue when concatenation is done to build nested paths (for instance, the default path for publishing application manifests becomes a sibling of the output directory instead of a child of the output directory).

Simply adding a single trailing backslash (e.g. /p:OutputPath="C:\MyApp\build\") causes a much more serious error in which the single backslash escapes the closing quote and pulls following command line arguments into the property value.

The correct command line argument for setting $(OutputPath) should be /p:OutputPath="C:\MyApp\build\\"

@dsyme
Copy link
Collaborator

dsyme commented Apr 14, 2016

@Cawifre Is this still an issue?

@Cawifre
Copy link
Author

Cawifre commented Apr 28, 2016

@dsyme Yes.

@rikharink
Copy link

I'm also facing this issue with the XamarinBuildHelpers but I think they use MSBuild in the end. I see that the xbuild command that it generates misses a trailing backspace and adding one to the command fixes my problems. Is there any known workaround for this problem?

@Cawifre
Copy link
Author

Cawifre commented Mar 9, 2017

@meidor this is the workaround I use:

let buildDir = @".\build\"
let expandOutputPath = FullName >> trimSeparator >> sprintf @"%s\\"
"MyApp.sln"
    |> MSBuild "" "Rebuild" [("OutputPath", expandOutputPath buildDir); ("Configuration", "Release")]
    |> Log "MyApp-Output: "

I've not used the XamarinBuildHelpers, but you may be able to use a similar technique.

@SimonCropp
Copy link

can confirm this is still an issue Fody/Fody#290

@sliepie sliepie mentioned this issue May 1, 2018
matthid added a commit that referenced this issue May 4, 2018
@matthid
Copy link
Member

matthid commented May 4, 2018

Fixed with #1905 in rc011 thanks to @JarnoNijboer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants