Building a solution which contains a windows service and a windows forms project

怎甘沉沦 提交于 2019-12-25 05:38:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!