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

fix EmbeddedResource access on net472 #1083

Merged
merged 1 commit into from
May 20, 2023

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented May 20, 2023

There are three embedded resouces in NPOI.

  • functionMetadata.txt and font_metrics.properties in NPOI project
  • presetTableStyles.xml in NPOI.OOXML project

In previous, thee resource files on net472 has inconsistent settings against NET Core.

  • NPOI.csproj:
    The two files had shorthand LogicalNames.

       <ItemGroup>
         <EmbeddedResource Include="Resources\functionMetadata.txt">
           <LogicalName>functionMetadata.txt</LogicalName>
         </EmbeddedResource>
         <EmbeddedResource Include="Resources\font_metrics.properties">
           <LogicalName>font_metrics.properties</LogicalName>
         </EmbeddedResource>
       </ItemGroup>
    
  • NPOI.OOXML.csproj:
    presetTableStyles.xml had been properly regeistered in NPOI.OOXML.Core.csproj, but not in NPOI.OOXML.csproj as EmbeddedResource, so it had been already broken in net472.

After we migrate SDK style csproj in #1037, the default LogicalName which has assembly name + relative path in project is given to each embedded resourecs. But, the shorthand names were still used for net472 by conditional compilation, so the runtime resource loading has been failing.

This fix will significantly increase passed test numbers in net472.

net6.0: (nothing changed)

- NPOI.TestCases.Core           (net6.0) Fail (2484)   3 Not Run    2413 Passed    23 Failed    45 Skipped
- NPOI.OOXML.TestCases.Core     (net6.0) Fail (1426)   5 Not Run    1316 Passed    70 Failed    35 Skipped
- NPOI.OOXML4Net.TestCases.Core (net6.0) Fail   (91)   1 Not Run      78 Passed     2 Failed    10 Skipped

net472 (before):

- NPOI.TestCases.Core           (net472) Fail (2484)   3 Not Run    2000 Passed   436 Failed    45 Skipped
- NPOI.OOXML.TestCases.Core     (net472) Fail (1426)   4 Not Run    1143 Passed   244 Failed    35 Skipped
- NPOI.OOXML4Net.TestCases.Core (net472) Fail   (91)   1 Not Run      78 Passed     2 Failed    10 Skipped

net472 (after):

- NPOI.TestCases.Core           (net472) Fail (2484)   3 Not Run    2416 Passed    20 Failed    45 Skipped
- NPOI.OOXML.TestCases.Core     (net472) Fail (1426)   5 Not Run    1316 Passed    70 Failed    35 Skipped
- NPOI.OOXML4Net.TestCases.Core (net472) Fail   (91)   1 Not Run      78 Passed     2 Failed    10 Skipped

In runtime, properly load following three embedded resources on net472.
- `functionMetadata.txt` and `font_metrics.properties` in NPOI project
- `presetTableStyles.xml` in NPOI.OOXML project
@tonyqus
Copy link
Member

tonyqus commented May 20, 2023

LGTM

@tonyqus tonyqus added this to the NPOI 2.6.1 milestone May 20, 2023
@tonyqus tonyqus merged commit 3662d1f into nissl-lab:master May 20, 2023
@9rnsr
Copy link
Contributor Author

9rnsr commented May 20, 2023

Thanks!

@9rnsr 9rnsr deleted the fixEmbeddedResourceLogicalName branch May 20, 2023 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants