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

Self contained single executable publishing fails. #285

Open
rati-openkey opened this issue Jan 29, 2022 · 17 comments
Open

Self contained single executable publishing fails. #285

rati-openkey opened this issue Jan 29, 2022 · 17 comments
Labels

Comments

@rati-openkey
Copy link

Description
Whenever I try to publish a single executable from from Visual studio exception is being thrown.

Reproduction
create any empty asp.net core minimal API project ant reference this package, try to publish as self contained, a single executable

Expected behavior
Publishing succeeds.

Relevant package, tooling and runtime versions
Visual Studio 2022 (v17.0.5) Net 6.0 LTS

Additional context
image

@sungam3r
Copy link
Contributor

изображение
Please click that arrow and show appeared message.

@rati-openkey
Copy link
Author

rati-openkey commented Jan 30, 2022

image
Please use the following setup

<ItemGroup>
    <PackageReference Include="Serilog" Version="2.10.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
 </ItemGroup>

@sungam3r
Copy link
Contributor

What is your TFM in csproj?

@rati-openkey
Copy link
Author

<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

@sungam3r
Copy link
Contributor

Looking at your error output I think that this is caused by runtime.win.System.IO.FileSystem. 4.3.0 that is located deeper in the dependencies tree and has newer version of dependencies located upper. Try build with runtime identifier pointing to linux. Weird error.

@rati-openkey
Copy link
Author

sorry but that's not an option for me for now I will have to step away from this package and find an alternative way. if someone fixes this in the future would be nice if not u can close this but this is a real issue and only happens with the information given in this issue.

@sungam3r
Copy link
Contributor

Then just do what compiler says - add newer dependencies explicitly.

@sungam3r
Copy link
Contributor

Or even simpler - suppress NU1605 warning/error https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1605

It seems that you force TreatWarningsAsErrors for your project. NU1605 is warning. You may find WarningsNotAsErrors option rather usefull.

@rati-openkey
Copy link
Author

@sungam3r, actually that is what I am going to give a try and to a full regression testing I will treat NU1605 as warning not error and see how it goes.

@skomis-mm
Copy link

Looks similar to this issue.
@rati-openkey try to install latest Serilog.Settings.Configuration version and see if it helps

@rati-openkey
Copy link
Author

@skomis-mm thank you I will give it a try for sure and will report back.

@nblumhardt
Copy link
Member

Aiming to fix this with #287

@FeeSaver
Copy link

FeeSaver commented Feb 8, 2022

@rati-openkey You can add this to your .proj file and then publish should work. This has been issue for very long time.

	<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
	<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
	<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
	<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
	<PackageReference Include="System.Collections" Version="4.3.0" />

@nblumhardt
Copy link
Member

Version 5.0.0-dev-00259 of Serilog.AspNetCore should also fix this.

If anyone has a chance to test it and confirm - we can push this out as a stable release.

Thanks!

@FeeSaver
Copy link

FeeSaver commented Feb 8, 2022

Oh I didnt have the pre-release packages checked in, so I didnt see it. I have updated the package and now it publish without errors.

@nblumhardt
Copy link
Member

Excellent, thanks @FeeSaver 👍

@rati-openkey
Copy link
Author

Not able to run a full regression for sure but the publishing seems to be working.

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

No branches or pull requests

5 participants