Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to make a single project file for both Linux and Windows OS. Building solution on Linux OS through visual code, facing following Error.

/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018: System.ArgumentException: Invalid input specification: Found multiple entries with the same BundleRelativePath [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018:    at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]
/usr/share/dotnet/sdk/5.0.405/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Publish.targets(1017,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/home/abc/Repo/TestClient/TestClient/TestClient.csproj]


Error occurred during dotnet publish: 1


What I have tried:

<pre lang="XML"><pre><Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup> 
    <OutputType>Exe</OutputType> 
    <TargetFramework>net5.0</TargetFramework> 
    <IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows> 
    <IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX> 
    <IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux> 
  </PropertyGroup>

  <PropertyGroup  Condition="'$(IsWindows)'=='true'">
    <TargetFramework>net5.0</TargetFramework>
    <Nullable>warnings</Nullable>
    <Product>TestClient</Product>
    <Authors>Me</Authors>
    <Company>MyCompany</Company>
  </PropertyGroup>

  <PropertyGroup Condition="'$(IsLinux)'=='true'">
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <RootNamespace>TestClient</RootNamespace>
    <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
  </PropertyGroup>

  <PropertyGroup Condition="'$(IsLinux)'=='true'">
    <PackagePrefix>TestClient</PackagePrefix>
    <PackageName>TestClient_1.0.5</PackageName>
    <Version>1.0.5</Version>
    <Authors></Authors>
    <Company>MyCompany</Company>
    <SelfContained>True</SelfContained>
  </PropertyGroup>

  <ItemGroup  Condition="'$(IsLinux)'=='true'">
      <Content Include="/home/abc/Repo/TestClient/Deb_Installer/TestClient.desktop" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="1755">
      <LinuxPath>/usr/share/applications/TestClient.desktop</LinuxPath>
      </Content> 
      <Content Include="/home/abc/Repo/TestClient/Deb_Installer/TestClient.png" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="1755"/> 
      <Content Include="/home/abc/Repo/TestClient/TestClient/bin/Desktop/linux-unpacked/**" CopyToPublishDirectory="PreserveNewest" LinuxFileMode="1755"/> 
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="ElectronNET.API" Version="13.5.1">
    </PackageReference>
  </ItemGroup>
  
  <ItemGroup>
    <ProjectReference Include="..\TestClient.Common\TestClient.Common.csproj" />
    <ProjectReference Include="..\TestClient.DB\TestClient.DB.csproj" />
  </ItemGroup>

</Project>
Posted
Comments
charles henington 31-Mar-22 22:11pm    
what flavor of linux and does the OS have .netsdk installed?
DoingWork 1-Apr-22 1:11am    
OS: Ubuntu 18.
Yes .netsdk installed.
charles henington 1-Apr-22 18:07pm    
what response do you receive when you run dotnet --version from terminal? to my knowledge it should be version 2.2.204
DoingWork 13-Apr-22 5:58am    
Response of dotnet --version is 5.0.405

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900