NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.5k stars 13.68k forks source link

`dotnetCorePackages.sdk_8_0` missing file/does not work with vscode c# devkit #338447

Open griffi-gh opened 3 weeks ago

griffi-gh commented 3 weeks ago

Describe the bug

dotnetCorePackages.sdk_8_0 breaks the vscode c# extension because Wrapper.csproj file is missing

Steps To Reproduce

Steps to reproduce the behavior:

  1. create a nix flake devShell with dotnetCorePackages.sdk_8_0
  2. install c# extensions from nixpkgs
  3. init a project with dotnet new console
  4. try to start vscode, watch it fail with an error complaining about a missing file

Expected behavior

It should not fail

Screenshots

image image

Additional context

My devshell

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    yafas.url = "github:UbiqueLambda/yafas";
  };

  outputs = {
    self, nixpkgs, yafas, ...
  }: yafas.allSystems nixpkgs ({ pkgs, system }: let
    dotnet_sdk = pkgs.dotnetCorePackages.sdk_8_0;
    dotnet_runtime = pkgs.dotnetCorePackages.runtime_8_0;
  in {
    devShells.default = pkgs.mkShell rec {
      buildInputs = with pkgs; [
        dotnet_sdk
        dotnet_runtime
        dotnetPackages.Nuget
        omnisharp-roslyn
        mono
        msbuild
      ];
      LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
      DOTNET_ROOT = "${dotnet_sdk}";
      DOTNET_CLI_TELEMETRY_OPTOUT = 1;
    };
  });
}

csproj file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
</Project>

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.6, NixOS, 24.11 (Vicuna), 24.11.20240828.71e91c4`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.25.0pre20240807_cfe66dbe`
 - nixpkgs: `/nix/store/887hpp8a2i99n9jjwcvz6qkhhhqsvzkg-source`

Add a :+1: reaction to issues you find important.

griffi-gh commented 3 weeks ago

image

Using the c# extension instead of the dev kit

Andreas02-dev commented 18 hours ago
┌─ build-support/dotnet/dotnetenv  
└─> pwd
/home/nixos/Data/consoleapp/.direnv/flake-inputs/s6d8irfyp66lvy9kapbfp2ass36c8lfl-source/pkgs/build-support/dotnet/dotnetenv

┌─ build-support/dotnet/dotnetenv  
└─> tree
.
├── build-solution.nix
├── default.nix
├── Wrapper
│   ├── Wrapper
│   │   ├── Properties
│   │   │   └── AssemblyInfo.cs
│   │   ├── Wrapper.cs.in
│   │   └── Wrapper.csproj.in
│   └── Wrapper.sln
└── wrapper.nix

4 directories, 7 files

It seems to me like something is going wrong in wrapper.nix. I'm not familiar with (any of) this myself, though..

@kuznero @mdarocha , could one of you please look into this?