Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
snippet of MSBuild for publish COM objects to a remote server using psexec
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="">
<PropertyGroup Condition="'$(Env)' == 'test'">
<!-- UNC path where we publish code-->
<!-- the remote path to where our code is deployed -->
<!-- the computer name for psexec -->
<PropertyGroup Condition="'$(Env)' == 'prod'">
<!-- where to copy our COM assembly -->
<!-- remote path to our where we published our COM assembly -->
<!-- remote path to our COM assembly -->
<!-- remote path to our typelib -->
<!-- local path to psexec-->
<!-- remote path to regasm.exe -->
<!-- remote path to iisreset.exe -->
<Target Name="DeployCOM">
<!-- local path our compiled, strongly-named COM assembly and it's dependencies -->
<FilesToCopy Include="$(MSBuildProjectDirectory)\src\My.Interop\bin\Release\*.*"/>
<MakeDir Directories="$(COMPublishFolder)"/>
<!-- unregister the old version of the DDL -->
<Exec Command="$(PsExecBinary) $(Computer) $(RegAsm) /u /codebase /tlb:$(COMTypeLib) $(COMAssembly)"
<!-- restart IIS -->
<Exec Command="$(PsExecBinary) $(Computer) $(iisreset) /restart" IgnoreExitCode="true"/>
<!-- copy new DLL to the server -->
<Copy SourceFiles="@(FilesToCopy)"
<!-- register the new DDL -->
<Exec Command="$(PsExecBinary) $(Computer) $(RegAsm) /codebase /tlb:$(COMTypeLib) $(COMAssembly)"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.