0

I'm working with a large number of *.csproj that have had the compile\clean targets replaced with a psake targets. Up until now it's been working by resolving to script(s) in a c:\fixedlocation\scripts folder. I'm moving towards to having all scripts\references in the source tree. Not all projects start at the same level in the source tree. So a relative path to get to the scripts folder won't work. They are all different.

I've thought about implementing a simple MSBUILD task to emit the property, but then, how does the project locate the DLL that contains the MSBUILD task. Same problem.

I could touch up the internals of project with a property, but that would have to be maintained if the project is moved.

The location of the scripts folder is a recursion up the tree (from MSBuildProjectDirectory) until the source tree root is found then down from there to sourceRoot\binn.

jeff
  • 3,269
  • 3
  • 28
  • 45
  • 1
    MSBuild has a so-called "property function" `GetDirectoryNameOfFileAbove` that does a recursive search up until a file with a given name is found. Is that what you are looking for? I'm not sure what the source tree root is, since it takes a file, but you could use something that's pretty much always going to be at the root like the solution file's name. – Mike Zboray Jun 17 '15 at 01:17
  • That just might do it. I'll try it when I'm at work tomorrow. I'm usually looking for a dir off the root. I can put a file there. Make your comment an answer. – jeff Jun 17 '15 at 01:22

0 Answers0