Propsfromenvsettings vdir not working

Topics: Bindings File, Settings Management and SSO, IIS and Web Services
Sep 29, 2011 at 1:18 PM

Hey,

I was wondering if anyone could tell me what is wrong with the following setup ? BizTalkType is defined in my environment file.

But when i install and deploy the msi, biztalktype is ignored. I end up with a directory Erio.Kompas.EDR

  <ItemGroup>
    <PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;BizTalkType" />
  </ItemGroup>
  <ItemGroup>
    <VDirList Include="*">
      <Vdir>Erio.Kompas.EDR.$(BizTalkType)</Vdir>
      <Physdir>..\Erio.Kompas.EDR.$(BizTalkType)</Physdir>
      <AppPool>ASP.NET v4.0</AppPool>
    </VDirList>
  </ItemGroup>

Greetings

Coordinator
Sep 29, 2011 at 9:55 PM

First thing to do is physically go and inspect the XML files exported from the spreadsheet (next to SettingsFileGenerator.xml) and make sure that you have an element in each one named BizTalkType that contains the value you expect for that environment.  If that's not the case, then you found the problem.  I can't remember if it's still true or not, but at one point the setting names were case-sensitive, so check that too.  You can also add <Target Name="CustomDeployTarget"><Message Text="BizTalkType=$(BizTalkType)"/></Target> to the end of your .btdfproj and look for that in the MSBuild output during a deploy.

Thanks,
Tom

Oct 6, 2011 at 10:01 AM
Edited Oct 6, 2011 at 10:02 AM

Thanks for the reply.

I tried all this, and the value is filled in. But yet, on creation of the vdir, it is ignored. Very strange :s It is still created as Erio.Kompas.EDR.

Coordinator
Oct 6, 2011 at 3:54 PM

OK, then it's almost certainly an MSBuild order-of-evaluation/parsing side-effect.  When the ItemGroup is evaluated by MSBuild, the property is not yet defined.  You could play with the physical order of the ItemGroup a bit, moving it after the Import task for instance, but I suspect that probably won't be enough.

You may need to dynamically create the ItemGroup, which is actually fairly simple.  Use the CreateItem MSBuild task.  The AdditionalMetadata is Vdir, Physdir and AppPool.  You can put the task into the same CustomDeployTarget target that I mentioned before.

<Target Name="CustomDeployTarget">
  <CreateItem Include="*" AdditionalMetadata="Vdir=Erio.Kompas.EDR.$(BizTalkType);Physdir=..\Erio.Kompas.EDR.$(BizTalkType);AppPool=ASP.NET v4.0">
    <Output TaskParameter="Include" ItemName="VDirList"/>
  </CreateItem>
</Target>

Thanks,
Tom

Oct 7, 2011 at 9:16 AM
Edited Oct 7, 2011 at 9:17 AM
Thanks, in local deployment this works, but when i try to build a msi, i get the following errors :


  Creating directory "obj\Debug\redist\DeployResults".
  md "obj\Debug\redist\DeployResults"
  Creating item group from CSV file 'VDirList.txt' using column names 'Vdir,Physdir,AppPool'.
error MSB4018: The "ItemGroupFromCSVFile" task failed unexpectedly. [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018: System.IO.FileNotFoundException: Could not find file 'D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\VDirList.txt'. [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018: File name: 'D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\VDirList.txt' [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, ...
(56,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at System.IO.StreamReader..ctor(String path) [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at DeploymentFramework.BuildTasks.ItemGroupFromCSVFile.Execute() [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, ...
Done Building Project "D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj" (Installer target(s)) -- FAILED.

Build FAILED.

"D:\TFS_Eriotrunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj" (Installer target) (1) ->
(Redist target) -> 
  (56,5): error MSB4018: The "ItemGroupFromCSVFile" task failed unexpectedly. [D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\Deployment.btdfproj]
(56,5): error MSB4018: System.IO.FileNotFoundException: Could not find file 'D:\TFS Erio\BizTalk\trunk\Erio.Kompas.EdrCreditServices\Deployment\VDirList.txt'. 

Coordinator
Oct 7, 2011 at 3:32 PM

It's looking for the file because the VDirList ItemGroup is not defined during the Installer build.  Please add <Target Name="CustomPreRedist"></Target> and copy the same <CreateItem> task into it.  Hopefully that will get VDirList defined and satisfy the MSI script.

Thanks,
Tom

Oct 11, 2011 at 8:30 AM

Thank you, it finally works :)

May 30, 2012 at 12:05 PM
Edited May 30, 2012 at 12:06 PM

Hi Thomas,

My approach is to use the environmentsettings to set the Connectionstring information and such for the ESB.config. This works great when i deploy from VS.Net, when deploying using an MSI install and build type 'Server' it doesn't. None of the EnvironmentSettings are filled in.

Defining the property

 

<PropsFromEnvSettings Include="ItineraryDb"

/> 

 

 

 Using it in the CustomDeployTarget

  <!--ESB Config Itinerary connectionstring -->

  <XmlFile.SetAttribute Path="$(EsbDir)\esb.configXPath="/configuration/connectionStrings/add[@name='ItineraryDb']" Name="connectionStringValue="Data Source=$(SqlServer);Initial Catalog=$(ItineraryDb);Integrated Security=SSPI;" Namespaces="@(ConfigNamespaces)" IgnoreNoMatchFailure="true" Force="true"

/>
  
 

 

I have tried to create the Item as suggested in the reply above, however this does not changes anything. When i analyze the .targets file the ServerDeploy eventually performs a DevDeploy, FrameWorkInitialize and because of this it should perform the SetEnvironmentPropSettings task, however not all tasks in the FrameworkInitialize seem to be executed.

 

  
For now i just set EnvironmentVariables in a batch script, but that isn't how i want it to be :(
  
 
Thanks a lot!
 

 

 

 

 

Coordinator
Aug 6, 2012 at 4:25 AM

On a Server deploy there is no difference in how properties are populated from the settings spreadsheet.  If the settings are in the XML file selected during the server deployment, then anything in PropsFromEnvSettings will be populated the same as under Visual Studio.

If you do have specific places to customize or add behaviors, the final release of V5.0 has quite a few additional extensibility targets.  For instance, a CustomPostInitialize target will run right after FrameworkInitialize.  CustomDeployTarget runs right after XML preprocessing and bindings file prep.

Thanks,
Tom