Copy of BTSNTSvc.exe.config/BTSNTSvc64.exe.config to BizTalk Directory Error File Not found

Topics: Server Deployment
Nov 17, 2011 at 2:34 PM


I am running into a strange error where I have one BTSNT config and copy the single to the 32bit/64 bit


<Target Name="CustomPostDeployTarget">
    <Copy DestinationFiles="$(EsbDir)esb.config" SourceFiles="$(RedistDir).\Configuration\esb.config" />
    <Copy  DestinationFiles="$(BtsDir)BTSNTSvc.exe.config" SourceFiles="$(RedistDir).\Configuration\BTSNTSvc.exe.config" />
    <Copy  DestinationFiles="$(BtsDir)BTSNTSvc64.exe.config" SourceFiles="$(RedistDir).\Configuration\BTSNTSvc64.exe.config" />
    <Exec Command="regedit /s .\Configuration\EventLog_Registry.reg" />
    <Exec Command="regedit /s .\Configuration\StaticSupport.reg" />

The files are copied to the re-dist \Configuration directory in the MSI package

 <Target Name="CustomRedist">
   <CreateItem Include=".\configuration\esb.config">
      <Output TaskParameter="Include" ItemName="ESBConfigGroup" />
    <CreateItem Include="$(RedistDir).\Configuration\BTSNTSvc.exe.config">
      <Output TaskParameter="Include" ItemName="BTSNTSvcConfigGroup" />
    <CreateItem Include="$(RedistDir).\Configuration\BTSNTSvc64.exe.config">
      <Output TaskParameter="Include" ItemName="BTSNTSvc64ConfigGroup" />
    <Copy  SourceFiles=".\configuration\DeploymentBTSNTSv.config" DestinationFiles="$(RedistDir).\Configuration\BTSNTSvc.exe.config"/>
    <Copy  SourceFiles=".\configuration\DeploymentBTSNTSv.config" DestinationFiles="$(RedistDir).\Configuration\BTSNTSvc64.exe.config" />
    <Copy  SourceFiles=".\configuration\esb.config" DestinationFiles="$(RedistDir).\Configuration\esb.config" />
    <Copy DestinationFolder="$(EsbDir)" SourceFiles="@(ESBConfigGroup)" />
    <Copy DestinationFolder="$(BtsDir)" SourceFiles="@(BTSNTSvcConfigGroup)" />
    <Copy DestinationFolder="$(BtsDir)" SourceFiles="@(BTSNTSvc64ConfigGroup)" />

I also have a question about permissions is it possible to have the deployment overwrite read-only files? The server seems to make the files read-only which is a good thing :-)

The error reported is that the config files are not found.



Nov 17, 2011 at 4:56 PM

Hi David,

$(RedistDir) is intended for use only on Debug or Release build configurations to facilitate the Installer target creating an MSI.  It lets you copy extra files into the obj\<config>\redist folder so that they get packaged into the MSI, as you're doing.  When you refer to file locations at deploy time in CustomPostDeployTarget you should just use a relative path.  The starting point is always the .btdfproj folder.

Unless you really need to have the config files in a "configuration" subfolder on a server install, you're doing a lot more work than is necessary.  You can simply define AdditionalFiles elements in an ItemGroup, same format as Orchestrations, Schemas, etc., and point to each of your config files.  They will automatically be packaged into the MSI (at relative path .\<file> when installed on the server).  If you're dealing with the difference between paths on server vs. developer machine, remember that you can make Targets, PropertyGroups and ItemGroups conditional, so you can use Condition="'$(Configuration)' == 'Server'" to test for a server install, for example.

When editing XML files at deploy/undeploy time, I generally advise using a granular update mechanism like the Microsoft.Sdc.Tasks.XmlFile task, which is already available to your .btdfproj (along with all of the Microsoft.Sdc.Tasks, see CodePlex project for documentation).  That lets you just add and remove particular elements vs. replacing an entire file.

Note that the BTDF updates the BizTalk config files too, so that's one area where you are overwriting changes, albeit non-critical in most cases.

You can use the MakeFilesWriteable task included with the BTDF to change read-only file attributes.


Nov 18, 2011 at 4:24 PM


I used your suggestions all good now.