Bug 14004 - MSBuild ItemSpecs are escaped on save.
Summary: MSBuild ItemSpecs are escaped on save.
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: (C7)
Assignee: Lluis Sanchez
URL:
: 14041 ()
Depends on:
Blocks:
 
Reported: 2013-08-15 11:38 UTC by Jonathan Pryor
Modified: 2016-05-19 19:05 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
App.zip (2.59 KB, application/zip)
2013-08-15 11:38 UTC, Jonathan Pryor
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jonathan Pryor 2013-08-15 11:38:59 UTC
Created attachment 4645 [details]
App.zip

MSBuild properties are escaped on save, breaking the build on "complicated" .csproj files.

To reproduce:

1. Extract App.zip, then open App.sln
2. Note that App.csproj contains this fragment:

    <Compile Include="$(IntermediateOutputPath)\Foo.cs" />

3. Within the Solution panel, right-click the App project then click Add > New File...
4. Within the New File dialog, select General > Empty Class. Click New.
5. View App.csproj.

Expected behavior: the line mentioned in (2) is unchanged. This is what Visual Studio does.

Actual behavior: the line mentioned in (2) is changed, and '$', '(', and ')' are hex encoded:

    <Compile Include="%24%28IntermediateOutputPath%29\Foo.cs" />

This causes builds to break; what used to build Just Fine (with xbuild) no longer does so:

$ xbuild
	: error CS2001: Source file `$(IntermediateOutputPath)/Foo.cs' could not be found
Comment 1 Mikayla Hutchinson [MSFT] 2013-08-15 14:19:55 UTC
The question is how exactly we can roundtrip this sanely, since the MSBuild expression characters are legal in filenames, and we should be exposing unescaped values in the UI. Currently we unescape on deserialize, and escape on serialize, which is why you're seeing this.

One possibility would be that when saving we could inspect the existing serialized value in the file, and if it matches w/o escaping, then we wouldn't escape it.
Comment 2 Mikayla Hutchinson [MSFT] 2013-08-16 16:10:01 UTC
Also, that's not a property, it's an itemspec.
Comment 3 Mikayla Hutchinson [MSFT] 2013-08-16 16:10:26 UTC
*** Bug 14041 has been marked as a duplicate of this bug. ***
Comment 4 mholenko 2015-03-24 04:30:03 UTC
Bump. This issue is still present in commit 23bd904220e6cf768e73447429cbbb8ea69075de of MonoDevelop. Is there any chance it would be resolved? 

I just tested the behaviour on VisualStudio 2012 and it works fine there.
Comment 5 Lluis Sanchez 2015-12-09 15:33:54 UTC
Fixed in XS 6.0.