We are using NHibernate in our project and need all .hbm.xml files to be embedded resources.
To automate this boring task we added this target definition to our project file:
<Target Name="BeforeBuild">
<ItemGroup>
<EmbeddedResource Include="**\*.hbm.xml" />
</ItemGroup>
</Target>
It works only if all hbm.xml files have build action None. But in our project some files are manually set to Embedded Resource and there is no chance to change all of them right now.
So we get build error “The item was specified more than once in the “Resources” parameter and both items had the same value for the “LogicalName” metadata. Duplicate items are not supported by the “Resources” parameter unless they have different values for the “LogicalName” metadata.”
Is it possible to write a target that changes build action only for .hbm.xml files with build action None (or NOT Embedded Resource)?
Will it work to first remove the ones already set to Embedded resource, before adding them all in?