Created
March 22, 2012 17:04
-
-
Save mjul/2159742 to your computer and use it in GitHub Desktop.
MSBuild start and stop WCF service host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<PropertyGroup> | |
<WcfSvcHost>$(MSBuildProjectDirectory)\Build\WcfServiceHost\wcfsvchost.exe</WcfSvcHost> | |
<AsyncStartWcfServiceHostCode> | |
<![CDATA[ | |
Public Shared Function ScriptMain() as String | |
Dim p As New Process | |
Dim pi As New ProcessStartInfo | |
pi.arguments = "/service:App\MyApp.Server.Services\bin\Debug\MyApp.Server.Services.dll /config:App\MyApp.Server.Services\bin\Debug\MyApp.Server.Services.dll.config" | |
pi.FileName = "$(WcfSvcHost)" | |
p.startinfo = pi | |
p.Start() | |
return p.Id.ToString() | |
End Function | |
]]> | |
</AsyncStartWcfServiceHostCode> | |
</PropertyGroup> | |
<Target Name="StartServices"> | |
<Message Text="Starter WCF services...." /> | |
<Script Language="VB" Code="$(AsyncStartWcfServiceHostCode)" Imports="System;System.Diagnostics"> | |
<Output TaskParameter="ReturnValue" PropertyName="WcfServiceHostProcessId" /> | |
</Script> | |
<Message Text="WCF PID: $(WcfServiceHostProcessId)" /> | |
</Target> | |
<Target Name="StopServices"> | |
<Message Text="Stopper WCF services...." /> | |
<Exec Command="taskkill /F /PID $(WcfServiceHostProcessId) /T" /> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment