1

I have a property sheet in Visual Studio 2010 that imports some other property sheets. My property sheet's imports section looks like this:

  <ImportGroup Label="PropertySheets">
    <Import Project="something.props" />
    <Import Project="something.else.props" />
  </ImportGroup>

I want to make sure that the person who adds my property sheet, which imports something and something.else can't accidentally change the import order of my included sheets. For example this would be wrong:

    <Import Project="something.else.props" />
    <Import Project="something.props" />

I checked Microsoft's website but I can't find a way to prevent the order from being changed. In Visual Studio intellisense shows Condition and Label for <ImportGroup> and Condition, Label and Project for <Import>. Aside from setting the file read only (which won't last since I have to check it into source control) is there anything I can do inside my property sheet to prevent the order from being changed?

Thanks

loop
  • 3,460
  • 5
  • 34
  • 57
  • Why is this a problem? Do these sheets contain conflicting settings? And if they do, why is that necessary? – Hans Passant Sep 17 '12 at 19:42
  • @Hans I wish none of it was necessary. I'm trying to avoid some possible future aggravation. When the inheritance order is changed it could be a problem for precisely the reason you mention. – loop Sep 17 '12 at 19:51

1 Answers1

0

It's just wonderful that Label attribute for ImportGroup isn't defined in xml schema http://msdn.microsoft.com/en-us/library/5dy88c2e(v=vs.100).aspx. Sigh...

About question - I doubt you can make 100% buletproof solution due to msbuild nature of properties priority, but simple moving your own import to the bottom of msbuild file will guarantee some kind "protection" for your values.

Alexey Shcherbak
  • 3,394
  • 2
  • 27
  • 44
  • Thanks for your message. I don't understand what moving the import to the bottom of the file will do. Is that some trick? – loop Sep 21 '12 at 00:46
  • I re-read the question and figured that I tried to answer wrong question. I thougth that you want fix your import order to ensure no one will override your settings with some other. But looks like I just misunderstand the question and answered one I formulate for myself, not your question. Im sorry. Ignore this answer - it's not for the question asked here. – Alexey Shcherbak Sep 21 '12 at 19:25