Re configuring solution with many projects

2019-06-09 10:19发布

Our solution resides on TFS 2010 and now has 39 projects in it. One windows application project and 38 class libraries. So far, our windows application project holds all references to all class libraries with CopyLocal=true. This way build produces one folder with all dll's in it along with our .exe.

This setup no longer works for us and we need to remove all references from windows app. project (dll's are loaded using reflection anyway). How can I configure build to work as before but without references in windows app. project?

2条回答
劳资没心,怎么记你
2楼-- · 2019-06-09 11:05

When you build the project via MSBuild on the commandline you can do something like the following:

 msbuild yoursolution.sln /p:Configuration=Debug /p:OutDir=c:\your-specific-location

OutDir is the variable created from OutputPath in each project, so overriding it here will override it globally, ensuring all output from all projects built gets copied to this location.

查看更多
手持菜刀,她持情操
3楼-- · 2019-06-09 11:13

You need to modify the build of the 38 library projects. There are a few options:

You can alter each project so that the $(OutputPath) property points to the correct drop folder, something like this:

<PropertyGroup>
   <OutputPath>..\Application\bin\$(Configuration)</OutputPath>
</PropertyGroup>

If I were doing this, I'd alter all 39 properties to use a common import in which this were defined, and have them all build to a drop folder. Then just change the application project to point to the drop folder for debugging.

You can likewise (using a common import) wire in a post-build deployment step to copy the built assemblies to the drop folder as each project is built.

查看更多
登录 后发表回答