Build/Test Issues

Custom ItemGroups to be copied over to workspace

Started by nayan on 4,606 views

Hi,

I have some custom targets which operate on files included in a custom ItemGroup. e.g

<SettingFile Include="common.xml" />


But by default, NCrunch only recognizes "None, Content, Compile" items as mentioned in Implicit File Dependencies page.

As a workaround, I am currently adding the file twice just to get it building. e.g.


<SettingFile Include="common.xml" />
<None Include="common.xml">
    <Visible>False</Visible>
</None>


Is there any way to specify a list of custom Items which NCrunch should copy over ? That would be really useful in avoid all this duplication.

Thanks.
Hi,

There isn't any way to change the list of item types that are identified by NCrunch (this is hard-coded), but if the files have a common extension or placement, you should be able to use the additional files to include option to make NCrunch aware of them.

You can also try adding the following to your project file. It is somewhat easier to manage than manually adding each file twice:

<ItemGroup Condition="'$(NCrunch)' == '1'">
<Content Include="@(SettingsFile)" />
</ItemGroup>

Edited

Hi Remco,

Thanks for the quick reply.

Yes, it's possible to conditionally include the files but this quickly gets out of hand if there are different types of such custom items.

The information is already present in the csproj and it builds using MSBuild. So I feel it would be cleaner if we could specify such a list of custom items in project-level configuration file. Would this be a feasible feature request ?


For context, the scenario is coming up with some shared logic to be used by other teams. They have the freedom to add build targets, so I don't control the list of such custom items. Having a configurable list sounds easier than asking them to make sure to include the file in None or Content.
nayan wrote:
For context, the scenario is coming up with some shared logic to be used by other teams. They have the freedom to add build targets, so I don't control the list of such custom items. Having a configurable list sounds easier than asking them to make sure to include the file in None or Content.


This makes really good sense, and it's a good reason to request such a feature. I'm afraid that my priorities are a little tied according to demand for features like this, but you're very welcome to make a formal request for it if you like.
Thanks.

Posted the request here - https://ncrunch.uservoice.com/forums/245203-feature-requests/suggestions/7966077-configurable-list-of-custom-itemgroups-to-be-copie

Post a reply

Log in to reply.