AddProjectFile in ReportBuilder: bug adding sourcefiles
Status: Beta
Brought to you by:
akutz
The sourcefiles read from the projectfile are always asumed to be relative. I replaced following code in the private method AddProjectFile:
var fpath =
Path.GetFullPath(Path.GetDirectoryName(projectFilePath))
+ "\\" + n.Attribute(XName.Get("Include")).Value;
with this code:
var sourceFilename = n.Attribute(XName.Get("Include")).Value;
var isAbsolute = Path.IsPathRooted(sourceFilename);
string fpath;
if (isAbsolute)
fpath = sourceFilename;
else
fpath = Path.GetFullPath(Path.GetDirectoryName(projectFilePath)) + "\\" + sourceFilename;
It it better to use var ppath = Path.GetFullPath(Path.GetFullPath( Path.GetDirectoryName( Path.GetFullPath(solutionFilePath))) + "\" + sm.Groups["ppath"].Value);
Since I encountered a file path length limit issue, and resolved by about sentence.