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

how to build on Ubuntu/Linux with .net core 3.0.100 #637

Closed
xinyu391 opened this issue Nov 1, 2019 · 1 comment

Comments

@xinyu391
Copy link

@xinyu391 xinyu391 commented Nov 1, 2019

Description
build openxml-sdk failed with .net cor 3.0 on ubuntu19.04

Information

  • OS: Ubuntu 19.10
  • .NET Target: .net core 3.0.100
  • DocumentFormat.OpenXml Version: (2.9.1)

Repro

download and install .net core 3.0 https://dotnet.microsoft.com/download/dotnet-core/3.0
and set DOTNET_ROOT PATH

cd openxml-sdk
dotnet build # failed

Build FAILED.

/home/jesse/Software/dotnet3.0/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [/data2/jesse/work/Open-XML-SDK-2.9.1/test/DocumentFormat.OpenXml.Packaging.Tests/DocumentFormat.OpenXml.Packaging.Tests.csproj]

But in the folder bin/Debug/DocumentFormat.OpenXml/netstandard1.3/, I got dll files
DocumentFormat.OpenXml.dll
DocumentFormat.OpenXml.pdb

I copy these dll to my c# project (dotnet new console -o myApp, and copy code from here
then dotnet build, get error

**Build FAILED.

Program.cs(14,51): error CS0012: The type 'Package' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.IO.Packaging, Version=4.0.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. [/data2/jesse/work/myApp/myApp.csproj]
0 Warning(s)
1 Error(s)**

BUT finally, I got myApp works:
use this command to fix the above error.

dotnet add package System.IO.Packaging
my project file is

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="openxml-sdk">
      <HintPath>DocumentFormat.OpenXml.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="System.IO.Packaging" Version="4.6.0" />
  </ItemGroup>

</Project>

then dotnet build success!

@twsouthwick

This comment has been minimized.

Copy link
Collaborator

@twsouthwick twsouthwick commented Nov 19, 2019

Looks like when I added a sample that was .NET Framework specific, the sln file still picks it up. I've added a fix in #638. Please update and try again. I'll close for now, but please reopen if you're still having an issue. Worked for me on WSL with ubuntu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.