error MSB4057: The target "CreateDeb" does not exist in the project #46

Open
opened 2026-01-29 16:28:00 +00:00 by claunia · 8 comments
Owner

Originally created by @LeVence1 on GitHub (Jan 14, 2019).

Hello,

I followed the instructions located in the readme file but I get the following error if I execute dotnet deb -r debian9.5-x64 -f netcoreapp2.2.0 command.

C:\Users\Privat\Desktop\Server-Core\Server-Core\Server-Core.csproj : error MSB4057: The target "CreateDeb" does not exist in the project

This is how my Program.cs class looks like

using Dotnet.Packaging;

namespace Server_Core
{
    class Program
    {
        static int Main(string[] args)
        {
            PackagingRunner runner = new PackagingRunner("Debian/Ubuntu installer package", "CreateDeb");
            return runner.Run(args);
        }
    }
}

This is how my Server-Core.csproj file looks like

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <RootNamespace>Server_Core</RootNamespace>
    <ApplicationIcon />
    <StartupObject />
    <Version>1.0.0.0</Version>
    <Authors></Authors>
    <Company></Company>
    <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DefineConstants>DEBUG</DefineConstants>
    <Optimize>false</Optimize>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="dotnet-deb" Version="0.1.1-*" />
	<DotNetCliToolReference Include="dotnet-deb" Version="0.1.1-*" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Properties\Resources.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Update="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  
  <Target Name="PackageDebian" DependsOnTargets="CreateDeb" Outputs="$(DebPath)"/>

</Project>

Thank you.

Sincerley,
Chris

Originally created by @LeVence1 on GitHub (Jan 14, 2019). Hello, I followed the instructions located in the readme file but I get the following error if I execute ```dotnet deb -r debian9.5-x64 -f netcoreapp2.2.0``` command. ```C:\Users\Privat\Desktop\Server-Core\Server-Core\Server-Core.csproj : error MSB4057: The target "CreateDeb" does not exist in the project``` This is how my Program.cs class looks like ``` using Dotnet.Packaging; namespace Server_Core { class Program { static int Main(string[] args) { PackagingRunner runner = new PackagingRunner("Debian/Ubuntu installer package", "CreateDeb"); return runner.Run(args); } } } ``` This is how my Server-Core.csproj file looks like ``` <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.2</TargetFramework> <RootNamespace>Server_Core</RootNamespace> <ApplicationIcon /> <StartupObject /> <Version>1.0.0.0</Version> <Authors></Authors> <Company></Company> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> <GeneratePackageOnBuild>false</GeneratePackageOnBuild> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <DefineConstants>DEBUG</DefineConstants> <Optimize>false</Optimize> </PropertyGroup> <ItemGroup> <PackageReference Include="dotnet-deb" Version="0.1.1-*" /> <DotNetCliToolReference Include="dotnet-deb" Version="0.1.1-*" /> </ItemGroup> <ItemGroup> <Compile Update="Properties\Resources.Designer.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>Resources.resx</DependentUpon> </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Update="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <Target Name="PackageDebian" DependsOnTargets="CreateDeb" Outputs="$(DebPath)"/> </Project> ``` Thank you. Sincerley, Chris
Author
Owner

@jorgegarciax2 commented on GitHub (Feb 5, 2019):

I get the same error. Did you solve this issue?

@jorgegarciax2 commented on GitHub (Feb 5, 2019): I get the same error. Did you solve this issue?
Author
Owner

@qmfrederik commented on GitHub (Feb 15, 2019):

Try to make sure you have the latest version of Packaging.Targets (and dotnet-deb). I just updated the README:

    <PackageReference Include="Packaging.Targets" Version="0.1.56" />
@qmfrederik commented on GitHub (Feb 15, 2019): Try to make sure you have the latest version of Packaging.Targets (and dotnet-deb). I just updated the README: ``` <PackageReference Include="Packaging.Targets" Version="0.1.56" /> ```
Author
Owner

@budul100 commented on GitHub (Jun 12, 2019):

It seems that you have to run firstly the respective dotnet publish command and then the dotnet deb command. I had the same error, but after using dotnet publish it worked correctly.

@budul100 commented on GitHub (Jun 12, 2019): It seems that you have to run firstly the respective` dotnet publish` command and then the `dotnet deb` command. I had the same error, but after using ` dotnet publish` it worked correctly.
Author
Owner

@qmfrederik commented on GitHub (Jun 16, 2019):

This can happen if you did not run dotnet restore first (you shouldn't need to run dotnet publish).

Can you check whether this problem reproduces on a clean checkout, and that running dotnet restore fixes this?

@qmfrederik commented on GitHub (Jun 16, 2019): This can happen if you did not run `dotnet restore` first (you shouldn't need to run `dotnet publish`). Can you check whether this problem reproduces on a clean checkout, and that running `dotnet restore` fixes this?
Author
Owner

@aggsol commented on GitHub (Sep 9, 2019):

This can happen if you did not run dotnet restore first (you shouldn't need to run dotnet publish).

Can you check whether this problem reproduces on a clean checkout, and that running dotnet restore fixes this?

It does not fix it for me, neither publish nor restore fixed the Problem. I am using Rider 2019.1.2 on Windows 10. Command: dotnet deb -f netcore2.2 -r ubuntu.18.04-x64

@aggsol commented on GitHub (Sep 9, 2019): > This can happen if you did not run `dotnet restore` first (you shouldn't need to run `dotnet publish`). > > Can you check whether this problem reproduces on a clean checkout, and that running `dotnet restore` fixes this? It does not fix it for me, neither publish nor restore fixed the Problem. I am using Rider 2019.1.2 on Windows 10. Command: `dotnet deb -f netcore2.2 -r ubuntu.18.04-x64`
Author
Owner

@aggsol commented on GitHub (Sep 9, 2019):

I fixed it: I had to explicitly set the framework version in the project like

<RuntimeFrameworkVersion>2.2.6</RuntimeFrameworkVersion>
@aggsol commented on GitHub (Sep 9, 2019): I fixed it: I had to explicitly set the framework version in the project like ```xml <RuntimeFrameworkVersion>2.2.6</RuntimeFrameworkVersion> ```
Author
Owner

@budul100 commented on GitHub (Sep 9, 2019):

RuntimeFrameworkVersion

@aggsol is right. I was adding the following PropertyGroup:

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <RuntimeFrameworkVersion>2.2.6</RuntimeFrameworkVersion>
    <RuntimeIdentifiers>win10-x64;linux-x64</RuntimeIdentifiers>
  </PropertyGroup>

Afterwards my project was compiled without the need of using dotnet publish.

@budul100 commented on GitHub (Sep 9, 2019): > ``` > RuntimeFrameworkVersion > ``` @aggsol is right. I was adding the following PropertyGroup: ``` <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.2</TargetFramework> <RuntimeFrameworkVersion>2.2.6</RuntimeFrameworkVersion> <RuntimeIdentifiers>win10-x64;linux-x64</RuntimeIdentifiers> </PropertyGroup> ``` Afterwards my project was compiled without the need of using `dotnet publish`.
Author
Owner

@aggsol commented on GitHub (Sep 10, 2019):

@qmfrederik Maybe you could open up the wiki and list all relevant project properties and best practices, examples there?

@aggsol commented on GitHub (Sep 10, 2019): @qmfrederik Maybe you could open up the wiki and list all relevant project properties and best practices, examples there?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#46