0

Please or Register to create posts and topics.

COMref with dotnet Core 5 fixed

I used 'shell32' a lot to pull metadata from media files.  the Shell32.dll file is small and fast comparing to the other packages (I am not talking one or 2 files at a time.  I am talking hundred files a time).  After researching and trying many ways and many times, I find a work around (that's work for me).  

  1.  I need to edit .cproj file and add this script to it.

<Target Name="resolveInteropOutputPath" BeforeTargets="ResolveComReferences"
Condition="'@(COMReference)'!='' or '@(COMFileReference)'!=''">
<PropertyGroup Condition=" '$(InteropOutputPath)' == '' ">
<InteropOutputPath>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)</InteropOutputPath>
</PropertyGroup>
</Target>

for example on my project file:

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>

<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>false</BuildServerSideRenderer>
<Description></Description>
<Copyright></Copyright>
<PackageProjectUrl></PackageProjectUrl>
<Company></Company>
<Version></Version>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<!--fix com reference issue ytp-->
<Target Name="resolveInteropOutputPath" BeforeTargets="ResolveComReferences"
Condition="'@(COMReference)'!='' or '@(COMFileReference)'!=''">
<PropertyGroup Condition=" '$(InteropOutputPath)' == '' ">
<InteropOutputPath>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)</InteropOutputPath>
</PropertyGroup>
</Target>

...

...

 

I hope this will help someone in the future.

 

Thanks.