milahu / nixpkgs

Nix Packages collection
MIT License
1 stars 0 forks source link

buildDotnetModule: error NETSDK1100: set the EnableWindowsTargeting property to true #63

Open milahu opened 5 months ago

milahu commented 5 months ago
/nix/store/3p2v489xyw5kzbrc4mk1mya8sdbcpkyx-dotnet-sdk-6.0.421/
sdk/6.0.421/Sdks/Microsoft.NET.Sdk/targets/
Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5):
error NETSDK1100:
To build a project targeting Windows on this operating system,
set the EnableWindowsTargeting property to true.
[/tmp/deps-audioalign-RgzrB2/src/AudioAlign/AudioAlign.csproj]

AudioAlign.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0-windows</TargetFramework>
    <OutputType>WinExe</OutputType>
    <UseWPF>true</UseWPF>

looks like a "windows only" project

lets cross-compile and run with wine

buildDotnetModule {
  postPatch = ''
    substituteInPlace AudioAlign/AudioAlign.csproj \
      --replace \
        "<TargetFramework>net6.0-windows</TargetFramework>" \
        "<TargetFramework>net6.0-windows</TargetFramework><EnableWindowsTargeting>true</EnableWindowsTargeting>" \
  '';
$ ./result/bin/AudioAlign
You must install or update .NET to run this application.

App: /nix/store/52r8m784kq37b8vpgqd9x892w9975n9r-audioalign-1.7.0/lib/audioalign/AudioAlign
Architecture: x64
Framework: 'Microsoft.WindowsDesktop.App', version '6.0.0' (x64)
.NET location: /nix/store/l382qszrramhs6x8iqjkjl7fgizlyjy9-dotnet-runtime-6.0.29

No frameworks were found.

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.WindowsDesktop.App&framework_version=6.0.0&arch=x64&rid=nixos.24.05-x64

hmm ... now how to run wine dotnet.exe AudioAlign

WineHQ - .NET Framework

Installing .NET 6.0 in wine?

winetricks -q dotnetdesktop6

Installing .NET 4.0 Framework on Wine using Winetricks

winetricks list-installed

How to actually use .NET Framework under Wine environemnt?

https://nixos.wiki/wiki/DotNET

https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1100

https://stackoverflow.com/questions/77715442/how-to-solve-this-error-set-the-enablewindowstargeting-property-to-true-netsd

By default, .NET downloads all targeting packages but target and runtime packages are not automatically downloaded on unsupported platforms. These can be wrapped in cross-target downloads by setting the EnableWindowsTargeting property.