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

In net6, Can I GeneratePackageOnBuild for a SingleFile console application #26419

Open
moh-hassan opened this issue Jul 1, 2022 · 3 comments
Assignees
Labels
area-Single-File untriaged Request triage from a team member

Comments

@moh-hassan
Copy link

I create c# Console project in net6 to generate singlefile with the following setting

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>false</SelfContained>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
     
  </PropertyGroup>

<!-- .... other properties -->
</Project>

In visual studio 2022 I pack a package onbuild using the next line:

<GeneratePackageOnBuild>True</GeneratePackageOnBuild

The package generated ignore the above PublishSingleFile setting and generate package with multi files dependencies.

My alternative solution is using PowerShell to publish and pack the package.

Is there is a way for GeneratePackageOnBuild to use the PublishSingleFile setting?

@ghost ghost added the untriaged Request triage from a team member label Jul 1, 2022
@ghost
Copy link

ghost commented Jul 1, 2022

Tagging subscribers to this area: @agocke, @vitek-karas, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

I create c# Console project in net6 to generate singlefile with the following setting

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>false</SelfContained>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
     
  </PropertyGroup>

<!-- .... other properties -->
</Project>

In visual studio 2022 I pack a package onbuild using the next line:

<GeneratePackageOnBuild>True</GeneratePackageOnBuild

The package generated ignore the above PublishSingleFile setting and generate package with multi files dependencies.

My alternative solution is using PowerShell to publish and pack the package.

Is there is a way for GeneratePackageOnBuild to use the PublishSingleFile setting?

Author: moh-hassan
Assignees: -
Labels:

area-Single-File, untriaged

Milestone: -

@agocke
Copy link
Member

agocke commented Jul 1, 2022

Looks like the pack task may need to be updated to handle publish output. Moving to SDK.

@agocke agocke transferred this issue from dotnet/runtime Jul 1, 2022
@moh-hassan
Copy link
Author

Is there any progress for this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Single-File untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

4 participants