开发者

Copy non-referenced projects from solution to the solution's startup-project

Is there anyway to copy the ouput of projects to the bin folder of the current startup-project from the solution? Is it even possible to know which project is the startup project from within a MSBuild script? The projects I am speaking of are PRISM modules and due to their modularity, they aren't referenced by the shell project. However, we still add them to our solution.

Until now, we had a pretty neat solution to debug our application. Our Infrastructure project (which is the at lowest level of the build process) would delete a ...Shell\bin\Debug\Modules folder. This application's bootstrapper is configured to load modules directly from the "Modules" directory. All module-projects have their OutputPath configured to this folder.

This build process has the advantage that we can choose which modules we want to debug by simply Loading/Unloading the project. The modules folder is always emptied at the start and only loaded projects are built. This is a configuration-free way of debugging different mix of modules.

How, we started a new PRISM Project that uses modules we have already created for the other Shell. Now I face the problem that this comfortable setup cannot work anymore. A single module project has a fixed OutputPa开发者_如何学Pythonth and developers wouldn't be able to reuse the projects in different solutions without problems.

Btw, it musn't be an MSBuild script, but is must be automated.

Edit: I forgot to stress the point that the same idea should work with multiple Prism Shells using common modules and that I can work on multiple PRISM Products simultaneously. That why I can't used a shared Output Path for all folders.


You can specify an AfterBuild Target in MSBuild to copy the outputs of other projects like this:

<Target Name="AfterBuild">
   <Copy SourceFiles="$(SolutionDir)MyProject1\bin\$(Configuration)\*.dll" DestinationFolder="$(TargetDir)"/>
   <!-- repeat for other projects -->
</Target>

AFAIK, finding out the startup project is not trivial as that info is stored in .suo file. You can explore writing your own MSBuild task or extending MSBuild Community task: GetSolutionProjects


You could configure the OutputPath of your "new" project to point to the same ...Shell\bin\Debug folder as your "shell" application. That way the new application can again load its modules from the very same Modules folder. No changes to any other part of the system are required.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜