VahidN / EPPlus.Core

EPPlus.Core is an unofficial port of the EPPlus library to .NET Core
GNU Lesser General Public License v3.0
370 stars 93 forks source link

.Net Core 2.0 Not Working #17

Closed dvlkv closed 7 years ago

dvlkv commented 7 years ago

[CS0012] The type 'Image' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

My Code is:

worksheet.HeaderFooter.OddFooter.InsertPicture(new FileInfo("Images/docWatermark.png"), PictureAlignment.Right);

.csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="DocumentFormat.OpenXml" Version="2.7.2" />
    <PackageReference Include="EPPlus.Core" Version="1.5.2" />
    <PackageReference Include="iTextSharp.LGPLv2.Core" Version="1.3.2" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0-preview2-final" />
    <PackageReference Include="OpenXMLPowerTools.Core" Version="1.0.0" />
  </ItemGroup>
</Project>
VahidN commented 7 years ago

Ignore that warning in VSCode or other editors. The compiled program works (tested and it produces the expected .xlsx file). v1.5.2 for netstandard2.0 uses CoreCompat.System.Drawing.**v2** and not CoreCompat.System.Drawing.

dvlkv commented 7 years ago

It's a compiler error. I can't ignore it. It worked while i was using netstandard1.6

VahidN commented 7 years ago
dvlkv commented 7 years ago

Fixed it clearing packages by this: dotnet nuget locals all --clear Thank you