Powershell package missing/not working on release

I have a console application project where i'm using the powershell SDK, it works perfectly fine in debug but on release, everything except powershell works.

The only settings i've found where it works is when releasing the project as framework dependent and portable. Or at least it works on my pc, on other computers it says the dotnet runtime is missing, even when installed via the link provided.

Using self contained, .net6-windows and win-x86 doesn't work. Not quite sure what could be wrong? I've tried cleaning the project, the solution, restarting visual studio and my PC. Everything works as expected in debug but when I publish, powershell just doesn't work.

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

  <PropertyGroup>
      <OutputType>Exe</OutputType>
      <TargetFramework>net6.0-windows</TargetFramework>
      <UseWindowsForms>true</UseWindowsForms>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <UserSecretsId>dotnet-SocketService-04A4D71F-C305-4A5B-BD0B-529C28B25DAD</UserSecretsId>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
    <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.1" />
    <PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.2" />
    <PackageReference Include="System.Management" Version="6.0.0" />
    <PackageReference Include="System.Management.Automation" Version="7.2.1" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Speedtest\" />
  </ItemGroup>

  <ItemGroup>
    <None Update="Speedtest\speedtest.exe">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>

Profile settings

enter image description here



from Recent Questions - Stack Overflow https://ift.tt/3FexvpU
https://ift.tt/3noEuq3

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation