Open viraptor opened 1 year ago
Hope this helps: If I leave the intermediate objects, I see in Before
:
.method public hidebysig static bool 'VirtualChannelEntry'(valuetype 'Win32.WtsApi32'.'ChannelEntryPoints'& 'entry') cil managed
{
.custom instance void ['DllExport']'StreamDeckTransportClientCs'.'DllExportAttribute'::.ctor(string,
valuetype ['System.Runtime.InteropServices']'System.Runtime.InteropServices'.'CallingConvention') = ( 01 00 13 56 69 72 74 75 61 6C 43 68 61 6E 6E 65 // ...VirtualChanne
And in after:
.method public hidebysig static bool modopt(['mscorlib']'System.Runtime.CompilerServices.CallConvStdcall') 'VirtualChannelEntry'(valuetype 'Win32.WtsApi32'.'ChannelEntryPoints'& 'entry')
{
.export [1] as 'VirtualChannelEntry'
.maxstack 11
So it seems like the method was actually processed... But it's still not visible in the result.
Hello,
Make sure you are looking at a modified dll, not original. For your settings it should be inside x64 and x86 folders $(TargetDir)/x64/*.dll
If not, please attach the build log. Thanks.
🤦 Yes, the x64 directory does contain a file with the correct export. Is there any way I can include that in the published directory as well? It seems that publishing to folder uses the library without the exports in place.
Better to reconfigure it for x64 if you only need x64. After that, the modified version will be automatically in $(TargetDir) replacing the original which Publish providers use by default.
But if you need both x86 and x64, for example, add the following before line in .csproj:
<ItemGroup>
<DllExport86X64
Include="$(TargetDir)x86\$(TargetFileName);$(TargetDir)x64\$(TargetFileName)"
PlatformDir="$([System.IO.Directory]::GetParent(%(DllExport86X64.Directory)).Name)\"/>
<ResolvedFileToPublish Include="@(DllExport86X64)"
RelativePath="%(PlatformDir)%(Filename)%(Extension)"/>
</ItemGroup>
On 12.05.2023 5:37, Stanisław Pitucha wrote:
🤦 Yes, the x64 directory does contain a file with the correct export. Is there any way I can include that in the published directory as well? It seems that publishing to folder uses the library without the exports in place.
Awesome, thank you!
I've got projects in VS 2022 which try to export a single function through:
(type in the signature from https://www.codeproject.com/Articles/16374/How-to-Write-a-Terminal-Services-Add-in-in-Pure-C)
I can load up and successfully build the example "DotNetCoreLibrary3" project and the function is exported as expected (checked with
dumpbin /exports
)I compared the options I'm using to the example project and set exactly the same options in mine. (checked in the xml configs too)
I'm failing to see the exported symbol in my DLL though. I've tried new/clean core 6, standard 2 and framework 4.7 projects and none of them create the export. Tried with both debug and release builds. Each one goes through the configuration correctly and compiles successfully with the
[DllExport...]
attribute resolving and compiling.How can I figure out what I'm missing here?
The question is related to:
DllExport -version
: 1.7.4Data
tab: core 6 project:framework project: