Biztalk 2020 Build fails with AddBizTalkHiddenReferences after adding certain nuget packages - biztalk

Reproduction steps:
Stack: Windows 10, Visual Studio 2019 professional, BizTalk Server 2020 developer edition CU1.
In Visual Studio create a new Biztalk Server Project
Manage Nuget Package, Add a nuget package. pick one:
Known to break the build
autofac 6.0, 6.1, 6.2
nodatime 3.0.5
Azure.Storage.Blobs 12.9.1
Known to not break the build
autofac 5.2
many others I tested.
F6 (Build) or run msbuild
As far as my testing was going, whenever the nuget packages directly list a variant with a .net framework as a dependency, it works. Listing only .net standard and .net 5 as a dependency, as in the list above, fails the buil.
actual error:
PS C:\code\autofacRepro> msbuild
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 8/24/2021 3:01:10 PM.
Project "C:\code\autofacRepro\autofacRepro.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "C:\code\autofacRepro\autofacRepro.sln" (1) is building "C:\code\autofacRepro\autofacRepro.btproj" (2) on node 1 (default targets).
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: The "AddBizTalkHiddenReferences" task failed unexpectedly. [C:\code\autofacRepro\autofacRepro.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: System.ArgumentException: String cannot have zero length. [C:\code\autofacRepro\autofacRepro.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: at System.Reflection.AssemblyName..ctor(String assemblyName) [C:\code\autofacRepro\autofacRepro.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: at Microsoft.VisualStudio.BizTalkProject.BuildTasks.AddBizTalkHiddenReferences.GetAssemblyNamesFromItems(ITaskItem[] items) [C:\co
de\autofacRepro\autofacRepro.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: at Microsoft.VisualStudio.BizTalkProject.BuildTasks.AddBizTalkHiddenReferences.Execute() [C:\code\autofacRepro\autofacRepro.btproj
]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\code\autofacRepro\autofacRep
ro.btproj]
C:\Program Files (x86)\MSBuild\Microsoft\BizTalk\BizTalkCommon.targets(190,9): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() [C:\code\autofacRepro\autofacRepro.btproj]
Done Building Project "C:\code\autofacRepro\autofacRepro.btproj" (default targets) -- FAILED.
Done Building Project "C:\code\autofacRepro\autofacRepro.sln" (default targets) -- FAILED.
Build FAILED.
A repro zip package is available in this github issue. (at first I thougt, it was a special issue with autofac, but it is not)
My old stack (windows server 2016, visual studio 2015, biztalk 2016) is not affected. We are using autofac 6.1 in biztalk projects there without any issue.
I feel like this is a BizTalk bug but I am not smart enough to find the way Microsoft allows reporting it.
So finally the question is, is there a workaround or a bugfix?

I've had this with one of my own packages. This package was targeting .NET Standard 2.0. I had to add .NET Framework 4.8 (in my case) specifically as a target framework in the class library and recreate the package for it.
For public packages, you may want to create a PR or make a fork to include targeting of .NET Framework. Your BizTalk project then needs to reference the .NET Framework assembly rather than the .NET Standard one.

Related

SonarQube Scanner throwing error

I asked to use SonarQube to analyse the .NET Project. I installed sonarqube-5.6.7 and everything working fine as expected but the issue arise when I build the .net solution using MSBuild.SonarQube.Runner.exe. Solution is getting build successfully but getting error while sending report to Sonar server.
Please note, I am using Visual studio 2012 project with 4.5.2 framework, I don't use TFS and even Jenkins.
SonarQube.Scanner.MSBuild.exe begin /k:"key" /n:"Project name" /v:"1.0" - This step seems to work fine.
MSBuild.exe /t:Rebuild - This step seems to work fine.
SonarQube.Scanner.MSBuild.exe end - This step fails.
Output of the failing step:
D:\...>SonarQube.Scanner.MSBuild.exe end
SonarQube Scanner for MSBuild 3.1
Default properties file was found at C:\Users\xxxx\Downloads\sonarqube-5.6.7
\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\Users\xxx\Downloads\sonarqube-5.6.7\bin
\SonarQube.Analysis.xml
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the re
quired information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the b
egin and end steps
2. An unsupported version of MSBuild has been used to build the project. Curre
ntly MSBuild 14.0 upwards are supported
3. The begin, build or end steps have not all been launched from the same fold
er
Generation of the sonar-properties file failed.
Unable to complete SonarQube analysis.
15:29:11.087 Creating a summary markdown file...
15:29:11.1 Post-processing failed. Exit code: 1
Can anyone let me know what I am missing?
As suggested below, I downloaded "sonar-scanner-msbuild-2.3.2.573.zip" and tried to rebuild the Visual Studio 2012 project which target framework version is 4.5.2 and got below errors. I tried to build with direct path of MSBuild 12 and also without giving the MSBuild full path but still getting the errors.
D:\test\test>C:\Users\xxxx\Downloads\sonarqube-5.6.7\bin\SonarQube.Scanner.M
SBuild.exe begin /k:"org.sonarqube:sonarqube-scanner-msbuild" /n:"Test Project"
/v:"1.0"
SonarQube Scanner for MSBuild 2.3.2
Default properties file was found at C:\Users\xxxx\Downloads\sonarqube-5.6.7
\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\Users\xxxx\Downloads\sonarqube-5.6.7\bin
\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
11:23:11.818 Updating build integration targets...
11:23:11.863 Fetching analysis configuration settings...
11:23:13.712 Generating rulesets...
11:23:13.776 Provisioning analyzer assemblies for cs...
11:23:13.778 Installing required Roslyn analyzers...
11:23:13.992 Pre-processing succeeded.
D:\test\test>MSBuild.exe /t:Rebuild
Microsoft (R) Build Engine version 4.0.30319.34209
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
Build started 09/10/2017 11:23:29.
Project "D:\test\test\test.sln" on node 1 (Rebuild target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
Project "D:\test\test\test.sln" (1) is building "D:\test\test\test\test.csproj"
(2) on node 1 (Rebuild target(s)).
CoreClean:
Deleting file "D:\test\test\test\bin\test.dll".
Deleting file "D:\test\test\test\bin\test.pdb".
Deleting file "D:\test\test\test\obj\Debug\test.csprojResolveAssemblyReferenc
e.cache".
Deleting file "D:\test\test\test\obj\Debug\test.dll".
Deleting file "D:\test\test\test\obj\Debug\test.pdb".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output fi
les are up-to-date with respect to the input files.
CoreCompile:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,
1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyv
a+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewor
k\.NETFramework\v4.5.2\Microsoft.CSharp.dll" /reference:"C:\Program Files (x8
6)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\mscorlib.dll
" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework
\.NETFramework\v4.5.2\System.ComponentModel.DataAnnotations.dll" /reference:"
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework
\v4.5.2\System.Configuration.dll" /reference:"C:\Program Files (x86)\Referenc
e Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Core.dll" /refer
ence:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFra
mework\v4.5.2\System.Data.DataSetExtensions.dll" /reference:"C:\Program Files
(x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.D
ata.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fr
amework\.NETFramework\v4.5.2\System.dll" /reference:"C:\Program Files (x86)\R
eference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Drawing.d
ll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewo
rk\.NETFramework\v4.5.2\System.EnterpriseServices.dll" /reference:"C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Sy
stem.Web.ApplicationServices.dll" /reference:"C:\Program Files (x86)\Referenc
e Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Web.dll" /refere
nce:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFram
ework\v4.5.2\System.Web.DynamicData.dll" /reference:"C:\Program Files (x86)\R
eference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\System.Web.Entit
y.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Fram
ework\.NETFramework\v4.5.2\System.Web.Extensions.dll" /reference:"C:\Program
Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2\Sys
tem.Web.Services.dll" /reference:"C:\Program Files (x86)\Reference Assemblies
\Microsoft\Framework\.NETFramework\v4.5.2\System.Xml.dll" /reference:"C:\Prog
ram Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2
\System.Xml.Linq.dll" /debug+ /debug:full /optimize- /out:obj\Debug\test.dll
/subsystemversion:6.00 /target:library /utf8output Properties\AssemblyInfo.cs
"C:\Users\xxxx\AppData\Local\Temp\.NETFramework,Version=v4.5.2.AssemblyA
ttributes.cs"
CopyFilesToOutputDirectory:
Copying file from "obj\Debug\test.dll" to "bin\test.dll".
test -> D:\test\test\test\bin\test.dll
Copying file from "obj\Debug\test.pdb" to "bin\test.pdb".
Done Building Project "D:\test\test\test\test.csproj" (Rebuild target(s)).
Done Building Project "D:\test\test\test.sln" (Rebuild target(s)).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.71
D:\test\test>C:\Users\xxxx\Downloads\sonarqube-5.6.7\bin\SonarQube.Scanner.M
SBuild.exe end
SonarQube Scanner for MSBuild 2.3.2
Default properties file was found at C:\Users\xxxx\Downloads\sonarqube-5.6.7
\bin\SonarQube.Analysis.xml
Loading analysis properties from C:\Users\xxxx\Downloads\sonarqube-5.6.7\bin
\SonarQube.Analysis.xml
Post-processing started.
The SonarQube MSBuild integration failed: SonarQube was unable to collect the re
quired information about your projects.
Possible causes:
1. The project has not been built - the project must be built in between the b
egin and end steps
2. An unsupported version of MSBuild has been used to build the project. Curre
ntly MSBuild 12.0 upwards are supported
3. The begin, build or end steps have not all been launched from the same fold
er
Generation of the sonar-properties file failed. Unable to complete SonarQube ana
lysis.
11:23:59.124 Creating a summary markdown file...
11:23:59.14 Post-processing failed. Exit code: 1
Starting from version 3.0, SonarQube Scanner for MSBuild requires MSBuild 14 or later to work.
It seems you have SonarQube Scanner for MSBuild 3.1,
but your project is build with Visual studio 2012,
which uses MSBuild 12.
You need to either:
Upgrade your Visual Studio project to 2015.
Use an older version of SonarQube Scanner for MSBuild (older than version 3.0)
Using an older version (2.3.2) you had a problem with the build step:
"C:\Program Files (x86)\MSBuild\12.0\Bin\"MSBuild.exe /t:Rebuild
This was required to work in order to be able to analyze.
According to your comment, the problem was resolved like so:
I have resolved this issue by updating C:\Program Files (x86)\MSBuild\12.0 folder with targets. I copy the target folder from MSBuild 4.0 to MSBuild 12.0 and it's working.

MSBuild missing target WebPublish

I am trying to publish a website at our CI server.
For some reason target WebPublish works when building with MSBuild 12.0 but not with MSBuild 14.0.
I can test it with following command: msbuild My.Web.csproj /t:WebPublish
It works with 12.0. MSBuild 14.0 gives error:
Build FAILED.
R:\My.Web\My.Web.csproj" (WebPublish target) (1) ->
R:\My.Web\My.Web.csproj : error MSB4057: The target "WebPublish" does not exist in the project.
0 Warning(s)
1 Error(s)
I have Visual Studio 2012 and 2015 installed. Is there something else I have to install in the CI server?
For anyone running into this problem currently, there are some alternative solutions posted on the following stack overflow question
The thing that fixed it for me was the "Web" and "Web Applications" folders found in the MSBuild directory for the version of visual studio that matched what I built my project in. In my case this was
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0
You have to install "Web Developer Tools". You can do it from "Programs and Features" and repairing Visual Studio 2015.

BizTalk 2013 R2: Error in receive pipeline

Facing an issue after deployment of BizTalk solution on another server.
Error is highlighted below:-
There was a failure executing the receive pipeline:
"BTAHL72XPipelines.BTAHL72XReceivePipeline, BTAHL72XPipelines,
Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Source: "BTAHL7 2.X Disassembler" Receive Port:
"HL7_25_ADT_A02_ReceivePort" URI: "******Some Location*******"
Reason: Field not found:
'Microsoft.Solutions.BTAHL7.Pipelines.MessageUtils.VersionforAck24'.
PS: I have already installed BizTalk 2013 R2 with HL7 Accelerator R2 two times on server.
It looks to me a installation issue, I have been running BizTalk 2013 R2 with HL7 Accelerator without any issues. Some suggestions
Most likely you have an old version of Microsoft.Solutions.BTAHL7.PipelineCommon.dll (possibly 2010 version). Make sure its version is 3.11.158.0. This assembly can be found in "\Program Files (x86)\Microsoft BizTalk 2013 R2 Accelerator for HL7\Bin" folder.
Uninstall HL7 Accelerator and Install it again, make sure you use 2013 R2 iso file
Is the assembly Microsoft.Solutions.BTAHL7.PipelineMessageCore deployed? Check under All Artifacts->Resources. Try redeploying it if it's in there.
Also take a look at the schema from that assembly under All Artifacts->Schemas and make sure it has the node. If it doesn't, you definitely have to redeploy from the original installation version, or at least undo any modifications that hav ebeen made to rename/remove that node.
Earlier we were using window server 2012.
In order to fix this issue, we did installation for window server 2012 R2,
Sql server 2014, VS 2013 and Framework 4.5.
Thanks all for helping out to resolve this issue.
I don't clearlyunderstand if it is a custom pipeline but if it is then you should copy your custom pipeline component to path
C:\Program Files (x86)\Microsoft BizTalk Server 2013 R2\Pipeline Components
if you are on development environment and tired of copying dll then a good way is:
Your dll mus must be deployed in GAC. Then a simpler way to do that is using gacutil.exe to deploy it. By the help of Visual Studio you can achieve this by post build event
"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\gacutil.exe" /i $(TargetPath)
After that you don't have to copy any dll but in production this may leads you forgetting to copy be careful.

QT Creator Build Error: failure during conversion to COFF

error: LNK1123: failure during conversion to COFF: file invalid or corrupt
I'am getting this error every time I try to build any project on my Qt Creator.
I have VS2010 installed and the compiler version set to MSVC C++ compiler 10.0(x86).
I have Qt 5.2.1 MSVC2010 32bit OpenGL.
This error appears because you have installed VS 2012 after you have actually installed VS 2010 in your system.
It can be solved if you install SP1 for VS2010.
An other solution is to go to
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe
and check the version of cvtres.exe. If the date is 03/18/2010 go to
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\cvtres.exe
and copy cvtres.exe then replace it On
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cvtres.exe
This error may occur when.Net Framework updated to 4.5.x. To resolve this error
You can change project properties as "Enable Incremental Linking -> "No (/INCREMENTAL:NO)".
Or, uninstall the .Net Framework 4.5.x and install .NET Framework 4.

BizTalk 2009 projects not playing well with TFS 2010 beta 2 automated build?

I was wondering if anybody is using TFS 2010 beta 2 build server to build BizTalk 2009 projects created in VS 2008?
I created new BizTalk project in VS 2008 adding simple schema with promoted property. Then I created new build definition from VS 2008 Team Explorer and queued up new build on our TFS 2010 build server...
I'm getting compilation errors due to the conflicts in .NET Framework versions. Here is a snippet from compilation log:
CoreCompile:
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.XLANGs.RuntimeTypes.dll" /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.BizTalk.Interop.Agent.dll" /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.BizTalk.Messaging.dll" /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.XLANGs.Engine.dll" /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.XLANGs.BizTalk.Engine.dll" /reference:"C:\Program Files\Common Files\Microsoft BizTalk\Microsoft.RuleEngine.dll" /reference:"C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.XLANGs.BizTalk.ProcessInterface.dll" /reference:C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.Xml.dll /reference:C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v4.0.21006\System.Web.Services.dll /reference:"C:\Program Files\Common Files\Microsoft BizTalk\Microsoft.BizTalk.TOM.dll" /debug:pdbonly /keyfile:somekey.snk /optimize+ /out:obj\Release\TestSchemas.dll /target:library /warnaserror- Properties\AssemblyInfo.cs "C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\SomeSchema.xsd.cs" "C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\PropertySchema.xsd.cs"
CSC : warning CS1685: The predefined type 'System.Runtime.InteropServices.DefaultParameterValueAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll' [C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\TestSchemas.btproj]
PropertySchema.xsd.cs(64,35): error CS0433: The type 'System.Xml.XmlQualifiedName' exists in both 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.21006\System.XML.dll' [C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\TestSchemas.btproj]
PropertySchema.xsd.cs(72,36): error CS0433: The type 'System.Xml.XmlQualifiedName' exists in both 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\System.XML.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.21006\System.XML.dll' [C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\TestSchemas.btproj]
Done Building Project "C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestSchemas\TestSchemas.btproj" (default targets) -- FAILED.
Done Building Project "C:\Builds\2\Test Project\Test Build\Sources\TestBizTalkApp\TestBizTalkApp.sln" (default targets) -- FAILED.
Done Building Project "C:\Builds\2\Test Project\Test Build\BuildType\TFSBuild.proj" (CompileSolution target(s)) -- FAILED.
Done Building Project "C:\Builds\2\Test Project\Test Build\BuildType\TFSBuild.proj" (CompileConfiguration target(s)) -- FAILED.
Done Building Project "C:\Builds\2\Test Project\Test Build\BuildType\TFSBuild.proj" (CoreCompile target(s)) -- FAILED.
As you can see, there are references to the same assemblies for two different framework versions (2.0 and 4.0) which is causing conflicts.
Our setup is: Win2008 box with BizTalk 2009, VS 2008 SP1 and we installed TFS 2010 beta 2 build service on the same box and configured to run only as an build agent. Then we've got another Win2008 box with TFS 2010 beta 2 which is configured as a source control and build server with only a build controller set-up.
Any help on how to get rid of the references to framework 4.0 from build would be much appreciated. Thanks!
We installed final version of TFS 2010 but had the same issue with conflicting assemblies. It turns out there is a bug in BizTalk build task. Details and workaround can be found here.
I submitted a bug report to Microsoft and here is reply:
We had a previous report around building BizTalk projects with TFS 2010 and I'm happy to say that it's been resolved for the release candidate. Thanks for reporting the issue.
I guess the only option now is to wait for RC and hope they really fixed that issue.

Resources