BTDF / DeploymentFramework

The Deployment Framework for BizTalk is the most powerful and customizable, yet easy-to-use toolkit for deploying and configuring your BizTalk solutions.
MIT License
53 stars 24 forks source link

BTDF v5.7 GetSoftwarePaths target resolves to V2.0 not v4.0 #456

Closed jasonhyland closed 4 years ago

jasonhyland commented 5 years ago

Hi, I am getting System.BadImageFormatException: Could not load file or assembly 'xxxx' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.. *\Framework\BizTalkDeploymentFramework.targets(1461,5): error MSB3073: The command "C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe /ShowCallStack "xxxx"" exited with code -1.

Target GetSoftwarePaths: is pointing to v2.0 framework Using .NET Framework Install Path 'C:\Windows\Microsoft.NET\Framework\v2.0.50727'. .net install path is some how pointing to v2.0 version, i think this needs to point to 4.0 version

Do I need to specify a property to get it to resolve to V4? Any help appreciated!

tfabraham commented 5 years ago

That would happen if you're executing MSBuild.exe < v4.0. Is this in Visual Studio, from a custom script..?

jasonhyland commented 5 years ago

Hi, This is running the MSI from the generated package. Its running MSbuild from c:\windows\microsoft.net\v4.0.30319;

SetModeDeploy:
  DEPLOYING APPLICATION TO BIZTALK...
SetWinVer:
  Running on Windows V100
  Detected IIS 7
  Detected 64-bit OS
GetSoftwarePaths:
  Using .NET Framework Install Path 'C:\Windows\Microsoft.NET\Framework\v2.0.50727'.
  Using BizTalk Install Path 'C:\Program Files (x86)\Microsoft BizTalk Server 2016\'.
  Using Deployment Framework Install Path 'C:\Program Files (x86)\XXXX.Integration.Common for BizTalk\1.0\Deployment\'
 .
  Using Deployment Framework Tools Path 'C:\Program Files (x86)\XXXX.Integration.Common for BizTalk\1.0\Deployment\Fra
  mework\DeployTools'.

 Finished deploying PDB's to GAC.
  Running installutil.exe on components...
  C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe /ShowCallStack "..\Aegis.Integration.Configuration.dll"
  Microsoft (R) .NET Framework Installation utility Version 2.0.50727.8745
  Copyright (c) Microsoft Corporation.  All rights reserved.

  Exception occurred while initializing the installation:
  System.BadImageFormatException: Could not load file or assembly 'file:///C:\Program Files (x86)\XXXX.Integration.Com
  mon for BizTalk\1.0\XXXX.Integration.Configuration.dll' or one of its dependencies. This assembly is built by a runt
  ime newer than the currently loaded runtime and cannot be loaded..
C:\Program Files (x86)\XXXX.Integration.Common for BizTalk\1.0\Deployment\Framework\BizTalkDeploymentFramework.targets
(1494,5): error MSB3073: The command "C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe /ShowCallStack "..\
XXXX.Integration.Configuration.dll"" exited with code -1. [C:\Program Files (x86)\Aegis.Integration.Common for BizTalk
\1.0\Deployment\Deployment.btdfproj]
tfabraham commented 5 years ago

Here's what doesn't make sense -- the .NET Framework Install Path comes from a built-in MSBuild task, GetFrameworkPath. It uses the "Path" output, which "Contains the path to the latest framework assemblies, if any are available." "If several versions of the .NET Framework are installed, this task returns the version that MSBuild is designed to run on."

I've always seen it follow that behavior. Are you absolutely certain that MSBuild.exe is running from v4? Are you getting this from a deployment in Visual Studio, from an MSI execution, other?

mrashwinprabhu commented 5 years ago

In the btdfproj file, adding the ToolsVersion="4.0" solves this issue and uses the v4.0 .NET framework. As in <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Installer" **ToolsVersion="4.0"**>

If Jason can rebuild the package with the above update to the btdfproj file, the resulted output should work correctly. I had this issue when I tried to deploy the solution from Visual Studio.

jasonhyland commented 5 years ago

Thanks Ashwin, this fixed it. Should have read the "upgrading" section in help better.