Build/Test Issues

IProjectGlobalPropertiesProvider

Started by JayBazuzi on 7,585 views

We have an extension for Visual Studio 2013 that uses IProjectGlobalPropertiesProvider + ProjectCollection.GlobalProjectCollection.SetGlobalProperty() to set some properties that are then consumed by the projects we want to build. This causes NCrunch to fail to build our projects.

For example, the extension includes a special .targets file, and then our projects have

<Import>$(MyExtensionDirectory)\MyCustom.Targets</Import>

Is there something special we should do to help NCrunch see these properties? Or should NCrunch recognize these custom properties?
Hi, thanks for posting!

Can you share any information about when these properties are set within the MSBuild life cycle? Is this being handled by a custom built MSBuild task?

Something that often needs to be done with NCrunch is to include MSBuild task .dlls using the Additional files to include configuration setting. Sometimes NCrunch doesn't automatically detect the build task files and they need to be explicitly included to be copied to the NCrunch workspaces.
It's handled by our package, when the package is loaded in to Visual Studio. It looks like we call ProjectCollection.GlobalProjectCollection.SetGlobalProperty("MyExtensionDirectory", ...) at that point. I wish I could hand you a simple, complete repro example; sorry!

I don't believe it's an issue with "Additional files to include". I found that if I hand-edit a project to add:

<PropertyGroup>
<MyExtensionDirectory>...</MyExtensionDirectory>
<PropertyGroup>

then NCrunch successfully builds & run tests, which is why I draw this conclusion.
Ahh - I understand. So you have a custom VS package that modifies the project properties in the IDE memory.

I'm afraid there's no way that NCrunch will be able to pick up such a property. NCrunch integrates with MSBuild, running it in processes spawned outside the IDE. In a similar way to what you've described, you may be able to work around this by introducing a conditional property group into the projects that require this, i.e:

<PropertyGroup Condition="$(NCrunch) == '1'"/>
<MyExtensionDirectory>$(ProjectDir)MyTempExtensionDir</MyExtensionDirectory>
</PropertyGroup>

Post a reply

Log in to reply.