-
Notifications
You must be signed in to change notification settings - Fork 118
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
Incompatible when used with .NET 5 in SingleFile option #32
Comments
Hello. This is due to PowerShell/MMI#45 - can you target |
same issue when targeting win-x64. Does not even need to be single file. |
Confirmed. |
Just to say I too have fallen over this. I don't understand the technicalities, but it looks like a long chain of dependency that would be good to cut out the middle man and go directly to the WMI interface. I'll resort to storing a GUID in a file the \Windows directory until then... |
This is obviously catching a lot of people out. For anyone seeing this issue and not wanting to change their runtime identifier, I would recommend just using v5.2.0 for now - it still uses WMI and thus doesn't have any of the issues with the MMI package. Moving forwards, I think the best option will be to provide both a WMI and a MMI package, so that people can choose which set of tradeoffs they want to make. I'll do this in the next release. |
Ahah! It does indeed work fine with 5.2. Thank you for correcting me. |
I'm working on a v6 release that will break out the various platform-specific stuff into its own packages. It will allow you to choose between using WMI and MMI on Windows. For the Windows stuff, you'll have a choice of: I'm going to go back to recommending the WMI stuff as a default, as the runtime issues with MMI are catching too many users out. Simple example using the new syntax: var deviceId = new DeviceIdBuilder()
.AddMachineName()
.AddUserName()
.OnWindows(windows => windows
.AddProcessorId()
.AddSystemSerialDriveNumber())
.OnLinux(linux => linux
.AddCpuInfo()
.AddSystemDriveSerialNumber())
.ToString(); v6 is currently available as an alpha. Alternatively, users who want to stay on v5 can use v5.2.0 for WMI or v5.3.0 for MMI. |
This error is not really fixed even though I am using the latest version of DeviceId 6.2.0 |
It actually is fixed but I can help you out. Are you using WMI or MMI? |
The following minimal reproduction confirms that it does work as described above: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DeviceId.Windows.Mmi" Version="6.2.0" />
</ItemGroup>
</Project> using System;
using DeviceId;
var deviceId = new DeviceIdBuilder()
.AddMachineName()
.AddUserName()
.OnWindows(windows => windows
.AddProcessorId()
.AddSystemDriveSerialNumber())
.ToString();
Console.WriteLine(deviceId); |
DeviceId.Windows.Mmi |
My application runs on two operating systems Windows 7/10 |
Please refer to the discussion I mentioned earlier: PowerShell/MMI#45 |
Here is a simple reproduction that confirms you can publish single file on <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.2.0" />
</ItemGroup>
</Project> using System;
using DeviceId;
var deviceId = new DeviceIdBuilder()
.AddMachineName()
.AddUserName()
.OnWindows(windows => windows
.AddProcessorId()
.AddSystemDriveSerialNumber())
.ToString();
Console.WriteLine(deviceId); |
Why can't be compatible with MMI |
I've linked to the discussion the MMI repo twice now. Please go read it. Here it is again: PowerShell/MMI#45 |
I have a sample WPF project running on .NET 5. Everything works fine for both debug and release environments. However, if I publish the project with target runtime as win-x64 or win-x86 with "Produce Single File" option, the following error occurs.
This error is logged with Serilog
The text was updated successfully, but these errors were encountered: