COM Wrappers are not copied correctly to publish directory when there is more than one COM reference
See original GitHub issueRepro
With the following project:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Access.dll">
<Guid>4affc9a0-5f99-101b-af4e-00aa003f0f07</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<Private>true</Private>
</COMReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Access.Dao.dll">
<Guid>4ac9e1da-5bad-4ac7-86e3-24f4cdceca28</Guid>
<VersionMajor>12</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
</COMReference>
</ItemGroup>
</Project>
Publish the project (with full MSBuild because that is needed for COMReference support): msbuild /restore /t:publish
Expected
Microsoft.Office.Access.dll
and Microsoft.Office.Access.Dao.dll
are both present in the publish folder
Actual
Neither is in the output folder, but a file with the names mashed together is: Interop.Microsoft.Office.Interop.Access.dll;Interop.Microsoft.Office.Interop.Access.Dao.dll
Analysis
It appears that the @
needs to be replaced by %
here: https://github.com/dotnet/sdk/blob/ac7fd98a7b6f8e625aab8977029813bec6088e70/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L528
Original issue description
With release 16.5 and SDK 3.1.200 the problem still exists !!! Now the dll name will corrupted
Why you don’t fix this with the new release ???
Interop.Microsoft.Office.Interop.Access.dll;Interop.Microsoft.Office.Interop.Access.Dao.dll;Interop.Microsoft.Office.Core.dll
only one file is copyed with all names inside !!!
Severity Code Description Project File Line Suppression State Error MSB3094 “DestinationFiles” refers to 3 item(s), and “SourceFiles” refers to 1 item(s). They must have the same number of items. Esi.Bootstrap.Package C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Microsoft\DesktopBridge\Microsoft.DesktopBridge.targets 692
<Target Name="_CopyPackageFiles" DependsOnTargets="_ConvertItems">
<Copy SourceFiles="%(File.FullPath)" DestinationFiles="%(File.CopyToTargetPath)" Condition="%(File.CopyToTargetPath) != ''"/>
<ItemGroup>
<FileWrites Include="%(File.CopyToTargetPath)" Condition="%(File.CopyToTargetPath) != ''" />
</ItemGroup>
</Target>
I created a new .net core wpf application and add a com dependency.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Access.dll">
<Guid>4affc9a0-5f99-101b-af4e-00aa003f0f07</Guid>
<VersionMajor>9</VersionMajor>
<VersionMinor>0</VersionMinor>
<WrapperTool>tlbimp</WrapperTool>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<Private>true</Private>
</COMReference>
</ItemGroup>
</Project>
On publishing to folder the COM+ reference dll will not copyed to the publishing folder.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (11 by maintainers)
Top GitHub Comments
Sounds good I’m excited !
@sidatacom This will be fixed in Visual Studio 16.6. It should likely make its way into preview versions of the 3.1.300 .NET Core SDK in the next few days. You can download the preview from the links in the table here: https://github.com/dotnet/installer/