Did you add a reference to WindowsBase
?
VS 2019 / VS 2017:
In VS menu,
- Click Project
- Select Add Reference...
- Click Assemblies
- Check WindowsBase
- Click OK
Also see: How to include the reference of DocumentFormat.OpenXml.dll on Mono2.10?
If you're looking for the latest version, you'll want to look at:
What's new in .NET 5
What is .NET Framework
Download .NET, .NET Core, and .NET Framework
Github: Open-XML-SDK
NuGet: DocumentFormat.OpenXml
Since you stated that you're a "fairly new developer", below is some information that may be useful to you.
ildasm
If you're interested in viewing which assemblies are used in a .NET DLL file or .NET .exe file, you can use ildasm.exe
from the Windows Kit.
Note: SDKs can be found in %ProgramFiles(x86)%\Microsoft SDKs\Windows\
(ex: C:\Program Files (x86)\Microsoft SDKs\Windows)
ildasm.exe
can be found in one or more of the following locations (given that the SDK was installed in the default location):
Win 10:
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.2 Tools\x64
...
Win 8.1:
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64
Win 7:
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\
- `%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.0A\bin\x64
Run ildasm.exe
- Double-click
ildasm.exe
to run it (or open a cmd
window and type ildasm.exe
)
- Click File
- Select Open
- Choose your DLL file or .exe file (ex: TestDLL35.dll)
- Double-click MANIFEST to open it in a new window
You'll see something like the following:
...

When you see: .assembly extern <name>
(ex: .assembly extern System.Core
), this specifies an assembly that is required. Look at .ver
inside the curly brackets to see the version of the assembly being used. For a .NET assembly this, is the .NET version for that library (ex: 3:5:0:0), shows that .NET 3.5 is used.

If one looks at ".ver" for .assembly DocumentFormat.OpenXml
, the version shows as 2:0:5022:0
which is version 2.0.5022.0.
NuGet packages
Here's some information about NuGet packages, if you install one (at home). If one installs a NuGet package, it can be found in %UserProfile%\.nuget\packages
. For example, the latest NuGet package DocumentFormat.OpenXml
, can be found in C:\Users\<username>\.nuget\packages\open-xml-sdk\<version>\lib\<.NET version>
(ex: C:\Users\TestUser\.nuget\packages\open-xml-sdk\2.9.1\lib\net46). OpenXml version 2.0, can be found in NuGet package DocumentFormat.OpenXmlSDK
(C:\Users\<username>\.nuget\packages\documentformat.openxmlsdk\2.0.0\lib\Net35)
In Visual Studio, the following setting determines whether or not the .NuGet package is copied to your local project folder:
In VS menu:
- Click Tools
- Select Options
- Expand NuGet Package Manager
- Click General
- Under Package Management, look at the value for Default package management format.
Note: When Packages.config is specified, and a .NuGet package is installed in your project, it will be downloaded to %UserProfile%\.nuget\packages\<NuGet package name>
and then copied to your solution folder (or project folder) to a folder called "packages". If PackageReference is specified, the .NuGet package is installed in your project, and it will be downloaded to %UserProfile%\.nuget\packages\<NuGet package name>
where your project will reference it which ensures that all of your projects use the same version of the NuGet package (it won't be copied to your solution folder/project folder). Also some settings are different in the .csproj file.
The file you listed above may be from the NuGet package DocumentFormat.OpenXmlSDK
(v.2.0.0) which looks like it requires .NET 3.5. The newest/lastest NuGet package for OpenXml is DocumentFormat.OpenXml
(v.2.12.1) and DLL's exist for .NET 3.5, .NET 4.0, and .NET 4.6.
See Package references (PackageReference) in project files and Migrate from packages.config to PackageReference