views:

274

answers:

1

We're having a problem combining 'nested files' and excluding files from source control.

We're using code generation to create two partial classes for each entity - MyBusinessObject.vb and MyBusinessObject.Generated.vb

We'd like the "Generated" file to appear as a nested file under the manual file. So we're modifying the project file to include entries like this:

<Compile Include="MyBusinessObject.vb" />
<Compile Include="MyBusinessObject.Generated.vb">
    <DependentUpon>MyBusinessObject.vb</DependentUpon>
</Compile>

This works fine by itself. Since we already have the code generation templates under source control, we'd also like to keep the "Generated" files out of source control so we only have to check out the project file to regenerate instead of everything. So we modified the project source control file like this:

{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "1"
"EXCLUDED_FILE0" = "MyBusinessObject.Generated.vb"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

This also works fine by itself. The problem is when we combine these two processes, MyBusinessObject.vb shows as being excluded from source control even though it's not marked as an excluded file in the project source control file like MyBusinessObject.Generated.vb is.

How can we have nested files and have the main file in source control and the nested file excluded from source control?

Thanks for your help!

A: 

Well, I ended up doing this a little differently. Since I couldn't get the nesting to work, I just made the generated files invisible to the project instead.

<Compile Include="MyBusinessObject.vb" />
<Compile Include="MyBusinessObject.Generated.vb">
    <Visible>false</Visible>
</Compile>

I can still see the files when I "Show All Files" just like with nesting. Not as cool as nested files, but this should work. I haven't seen any side effects yet.

Thanks anyway.