Bug 17316 - Monodevelop overwrites conditional references
Summary: Monodevelop overwrites conditional references
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Visual Studio Compatibility ()
Version: Trunk
Hardware: PC Linux
: --- normal
Target Milestone: master
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2014-01-19 00:01 UTC by Sergey Zhukov
Modified: 2014-02-11 03:28 UTC (History)
1 user (show)

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

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:
RESOLVED FIXED

Description Sergey Zhukov 2014-01-19 00:01:08 UTC
Monodevelop overwrites conditional references in *.csproj files with wrong values even if user does not change anything

Steps to reproduce:

Create empty console project named 'mdtest'
Open mdtest.csproj file for editing and in references <ItemGroup> add following lines:

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' == 'Debug' ">
      <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath>
    </Reference>
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' != 'Debug' ">
      <HintPath>..\Lib\Release\protobuf-net.dll</HintPath>
    </Reference>
  </ItemGroup>

Save the file and monodevelop reloads the project.
Select 'mdtest' project in solution pad. Right click and select 'Options'. Project Options window will open.
Do not change anything and click 'OK' button.

See that mdtest.csproj file was changed. <HintPath> of second reference instead of "..\Lib\Release\protobuf-net.dll" became "..\Lib\Debug\protobuf-net.dll" and the references <ItemGroup> now looks like:

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' == 'Debug' ">
      <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath>
    </Reference>
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' != 'Debug' ">
      <HintPath>..\Lib\Release\protobuf-net.dll</HintPath>
    </Reference>
  </ItemGroup>

-------------------
=== MonoDevelop ===

Version 4.2.3
Installation UUID: 941343e7-3193-4d86-b495-599972b9f70c
Runtime:
	Mono 3.2.7 (webperf1/51c69bf Mon Dec 30 00:57:45 NOVT 2013)
	GTK+ 2.24.10 (Ambiance theme)

=== Build Information ===

f3b05bf63e6af89e19f6f65252d57920da48f7cd

=== Operating System ===

Linux
Linux 3.2.0-58-generic-pae #88-Ubuntu SMP Tue Dec 3 18:00:02 UTC 2013 i686 i686 i386 GNU/Linux
Comment 1 Sergey Zhukov 2014-01-19 00:06:03 UTC
EDIT (mistaken copypaste in previous comment): 
---------------------------------
...the references <ItemGroup> now looks like:

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' == 'Debug' ">
      <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath>
    </Reference>
    <Reference Include="protobuf-net" Condition=" '$(Configuration)' != 'Debug' ">
      <HintPath>..\Lib\Debug\protobuf-net.dll</HintPath>
    </Reference>
  </ItemGroup>
---------------------------------------
END OF EDIT
Comment 2 Sergey Zhukov 2014-02-08 06:50:56 UTC
I made a pull request with fix to the bug

https://github.com/mono/monodevelop/pull/478
Comment 3 Lluis Sanchez 2014-02-11 03:28:31 UTC
Fixed merged.