MSBuild project reference override for pre-build assembly

Situation

I have about 400 csproj files using project references. About 3 of them, a separate team wants to fork and include in a standalone app.

I have forked 3 projects of interest and since a separate team uses diff SVN repo I used svn externals to pull those projects into the standalone app folder. Obviously, since this command uses a different folder structure, project references are no longer resolved.

Attempted solution

I decided to set the msbuild ReferencePath

and properties AdditionalLibPaths

to point to the directory with all the precompiled dependencies so that the project would reference the fallback point and resolve it correctly. However, it is not.

Question

  • Does anyone know how a failed project search to resolve the precompiled dll?
  • Perhaps call me an automatic tool to convert project references to dll references?
  • Or is there a better way to solve this problem?

thanks

+2


a source to share


2 answers


Project references are resolved by the target - ResolveProjectReferences. It basically calls GetTargetPath on the referenced project and uses that as the resolved project build path. IIUC, your project file path is wrong in the new setup, so GetTargetPath will fail.

You could solve this differently, like having a target [1] that maps the paths of the old project file to the allowed build targets and adds it to FooItem [2]. Or you can simply add all files from the directory from "all precompiled fingerprints" to @ (ReferencePath). ReferencePath is populated after resolution, so it has all trailing paths. Adding a search path to it won't help.



  • And add this target to ResolveReferencesDependsOn property

  • The GetTargetPath call should add the returned paths to the name of some item, replace FooItem with this item name.

+3


a source


Project files (csproj) are XML files, you can write your own tool if you need to do any manipulation:



-2


a source







All Articles