Closed sadedil closed 2 years ago
If you can find a way to achieve this I will be happy to accept a pull request.
It is possible to get a property value with IVsBuildPropertyStorage.GetPropertyValue
but there is no way of knowing if the property is from the FineCodeCoverage PropertyGroup and it is not possible to prefix each property with fcc.
As far as I remember there are issues with using Microsoft.Build.Evaluation too. I certainly do not fancy reinventing that wheel.
The alternative I propose is
FCC searches up the directory structure for fccOptions.xml. FCC to support merging from fccOptions at different levels. Have a root attribute topLevel to stop searching further up. Options that can be be merged - arrays - are merged dependent upon an attribute. Global visual studio options are also considered as part of this merge. Then project level options ( not from imported props ) override or merge with those from global / fccOptions.
Your thoughts ?
This code ( within CoverageProject Settings property ) does work but I am still hesitant to use it.
Microsoft.Build.Evaluation.Project evaluationProject = new Microsoft.Build.Evaluation.Project(this.ProjectFile);
var fccProperties = evaluationProject.AllEvaluatedProperties.Where(p => {
var isMatch = false;
var projectPropertyElement = p.Xml;
if (projectPropertyElement != null)
{
var parent = projectPropertyElement.Parent;
if (parent != null)
{
isMatch = parent.Label == "FineCodeCoverage";
}
}
return isMatch;
}).ToList();
See override globals. Requires different format for props Import
released v1.1.172 and available on marketplace
Installed product versions
Description
I've four different Test projects in my solution folder and I want to configure options with
<PropertyGroup Label="FineCodeCoverage">
approach. It's working when I add this property to each*.Tests.csproj
file separately. But if I use MSBuild's<Import>
statement in my*.Tests.csproj
files, it's not working.I've created a
FineCodeCoverage.props
file in root of the/test
folder and I imported this file from my*.Tests.csproj
files like<Import Project="../FineCodeCoverage.props" />
.Steps to recreate
/test/FineCodeCoverage.props
file with this content:/test/MyApp.Test1/MyApp.Test1.csproj
(XUnit) and add this line<Import Project="../FineCodeCoverage.props" />
/test/MyApp.Test1/MyApp.Test2.csproj
(XUnit) and add this line<Import Project="../FineCodeCoverage.props" />
Current behavior
Fine Code Coverage is not considered these options
Expected behavior
Fine Code Coverage should consider these options