Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Diagnostics.Tracing.TraceEvent NuGet not compatible with single file apps? #2035

Open
ppekrol opened this issue May 17, 2024 · 8 comments

Comments

@ppekrol
Copy link

ppekrol commented May 17, 2024

Hi, my csproj to reproduce the issue is as simple as:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
	  <PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.77" />
  </ItemGroup>

</Project>

When I issue following command:

dotnet publish --configuration Release --runtime win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true

All works fine and I'm ending up with 1 exe, but when I switch to linux-x64 (haven't checked other non-windows platforms)

dotnet publish --configuration Release --runtime linux-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true

Then I'm ending up with

image

Can I do something with this on my side or this needs to be handled on yours? Can you advise?

@cincuranet
Copy link
Collaborator

@brianrob We're now putting the native dependencies (like msdia) into build/native/amd64, etc. Maybe runtimes/{rid}/native (where rid would be win-x64, etc.) would be better place. That way it should not be selected for non-Windows publishes.

@ppekrol
Copy link
Author

ppekrol commented May 17, 2024

@cincuranet I think you are correct, our own package contains native libs and we are wrapping them up in 'runtimes'. Everything is working as expected then.

image

From my brief investigation it looks like those 3 directories do not even contain appropriate DLLs? The amd64 files are for windows-x64 and x86 one are for windows-x86? Nothing to do with linux there at all.

@cincuranet
Copy link
Collaborator

From my brief investigation it looks like those 3 directories do not even contain appropriate DLLs? The amd64 files are for windows-x64 and x86 one are for windows-x86? Nothing to do with linux there at all.

That's expected. These libraries are Windows-only.

@brianrob
Copy link
Member

I believe that this is fixed in a newer version of TraceEvent. Can you please try this with the latest version? I believe the change you need is #1845.

@cincuranet
Copy link
Collaborator

I confirmed the same behavior with Microsoft.Diagnostics.Tracing.TraceEvent 3.1.10

image

@cincuranet
Copy link
Collaborator

Mea culpa. The amd64 folder is actually empty. 🤦‍♂️

@ppekrol
Copy link
Author

ppekrol commented May 17, 2024

With <PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.10" />
and dotnet publish --configuration Release --runtime linux-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true I'm getting

image
and the amd64 has
image

@cincuranet
Copy link
Collaborator

cincuranet commented May 17, 2024

OK, I re-tested what I tested :) and now I do have files in amd64 as well. Go figure. That means the runtimes folder should be viable option.

I'll try to test it next week. Sounds good @brianrob?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants