问题
I have a solution which contains a windows service and a windows forms project. Is it possible to build the solution and have the output from both project in one folder ? The ouput folder should contain the windows service exe and also the win forms exe files.
回答1:
Use copy in both projects build events.
Like this
copy /Y $(ProjectDir)$(OutDir)output_file_you_want_to_copy C:\some_dest_dir
回答2:
Give both projects the same OutputPath with a fully qualified path that includes $(OutDir).
You'll need to examine the contents of your project files in a text editor. By default the OutputPath is defined across multiple property groups that change this value based on the $(Configuration) and $(Platform) values.
Your end result should have a common "OutputPath" located within both project files.
<PropertyGroup>
<AssemblyName>WebService</AssemblyName>
<RootNameSpace>Project.WebService</RootNameSpace>
<ProjectGuid>{deadbeef-dead-beef-dead-beefdeadbeef}</ProjectGuid>
<OutputPath>$(OutDir)\$(Configuration).$(Platform)\ProjectDropFolder\</OutputPath>
...
</PropertyGroup>
来源:https://stackoverflow.com/questions/17060458/building-a-solution-which-contains-a-windows-service-and-a-windows-forms-project