3F / MvsSln

🧩 Customizable VisualStudio .sln parser with project support (.vcxproj, .csproj., …). Pluggable lightweight r/w handlers at runtime, and more …
MIT License
135 stars 27 forks source link

DEaling with Properties in .??proj when the original definition is in a nested .props file... #39

Closed DynConcepts closed 3 years ago

DynConcepts commented 3 years ago

My goes is (still) to identify settings, be able to report on them, then be able to standardize them.... Hereis an example along with the error i am getting...

image

Also, many properties that are defined in a nested .props fail I have been unsuccessful in finding...

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
    </ClCompile>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup>
    <Midl>
      <HeaderFileName>%(Filename).h</HeaderFileName>
      <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName>
      <TypeLibraryName>%(Filename).tlb</TypeLibraryName>
    </Midl>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

Then in the vcxProj...

  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Typelib|Win32'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    <Import Project="..\..\..\..\Bldtools\PropertySheets\CustomLevel1.Typelib.Win32.props" />
    <Import Project="..\..\..\..\Bldtools\PropertySheets\CustomLEeel2.Typelib.Win32.props" />
  </ImportGroup>
DynConcepts commented 3 years ago

PRogress of a sort... For now I have been able to "override" the property (when it is found) by adding it to the .vcxProj.... This will "Get me through the night (darn, it is almost morning), and even through the (holiday) weekend....

But this is a poor solution as desired value not occurs in each relevant .vcxproj (literally 4000+) rather that in one single .props file...

3F commented 3 years ago

Because you're really trying to work with different nodes. Process of the evaluation is recursive as I was sayng earlier. And historically you need to process this separately if you want to modify something deep below other nodes (different parent).

MvsSln provides even this https://github.com/3F/MvsSln/blob/9ce5885282d65ee32bfc03808c83c1113c1928e3/MvsSln/Projects/PropertyItem.cs#L73-L76

And this https://github.com/3F/MvsSln/blob/9ce5885282d65ee32bfc03808c83c1113c1928e3/MvsSln/Core/IXProject.cs#L181

Try to use some cheat sheet from this projects: