how to add assembly DocumentFormat.OpenXml.Wordprocessin in visual studio - c#

I want to read a doc file and do some operation and I found a code, but it has asking following "WordprocessingDocument" namespace.Has anyone know from where I can find this assembly.please dont sent me a download link for .dll file because it not good to add third party .dll directly.

you can download "Open XML SDK 2.5 for Microsoft Office" from http://www.microsoft.com/en-us/download/details.aspx?id=30425
for using this lib go to http://msdn.microsoft.com/en-us/library/office/bb448854.aspx

As per recent updates and methods for adding any namespaces related to Open XML SDK please add name spaces like System.IO.Packaging, DocumentFormat.OpenXml etc via Nuget Package. You can find nuget package on https://www.nuget.org/packages/DocumentFormat.OpenXml/
To Install this Nuget Package you can open Nuget Package Mananger console (Tools -> Nuget Package Manager -> Nuget Package Manager Console) and make sure that you have right project selected in console dropdown.
Run the following command.
Install-Package DocumentFormat.OpenXml
Alternatively you can also install it via Nuget Package Manager GUI which you can open simply by Right clicking on Solution Explorer and going in 'Manage Nuget Packages'

Related

Install nuget package jetbrains rider

I would like to install a package i downloaded called swatch.AutofacConfiguration.1.3.0.nupkg
I have it stored locally. I just dont know how to install it.
I have tried using commands like
nuget install
nuget add -Source some/directory my.nupkg
I would like to add it to my solution please
The first thing I would suggest is instead of using the PMC (Package Manager Console) in Visual Studio use the Nuget Package Manager (which you can find by typing into the search bar at the top of the IDE).
Since the file extension is nupkg you can most definitely find it on there and have visual studio handle the installation and referencing. I hope that helps.

File is not accessible - Visual Studio 2017

I have downloaded Visual Studio 2017/Community, for test automation, but when I added the reference selenium-dotnet 3.14.0 , it's saying that this file is not accessible.
Please help. Thanks
click here to see the problem
Have you tried going to the NuGet Package Manager?
Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Then Search for Selenium and v3.14.0 is at the top
You can also do this from the NuGet Package Manager Console with:
Install-Package Selenium.WebDriver
According to the screenshot, you're trying to add a NuGet package through the "Add reference" dialog, which is designed to add references to DLLs directly. NuGet packages typically contain DLLs but you have to install them using the Manage NuGet Packages for Solution dialog as #ZP123 explained and not through Add Reference.

How to correctly reference a nuget package so it won't hard code a path

What is the best way to reference a libarary downloaded using nuget?
When I go to references and then find the path to the library inside of the packages folder, it seems to include my TFS branch path in the reference path.
How do I get it to reference the dll in a more generic way?
I don't see the "installed packages" options either:
What is the best way to reference a libarary downloaded using nuget?
You should set that nuget package to a local feed, then manage it with nuget.
Detail steps:
Create local feed:
Go to Tools->Options->NuGet Package Manager->Package Sources, click the green plus button, then add a available package source and configure the Name of package source and Source:
Add the downloaded package to the load feed, which you set in the Source of package source in the first step.
Manage package with nuget:
Right click on the References, select Manage NuGet packages..., select local feed source on the opened NuGet Package Manager window, find the downloaded package, then you can add it by clicking Install button:
Hope this helps.
Don't reference the package directly. Add the package to the project using Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.

Can't build solution because of missing NuGet references

Like title says, I can not build my solution(C#) as NuGet is spitting out this error
This project references NuGet package(s) that are missing on this
computer. Use NuGet Package Restore to download them. For more
information, see http://go.microsoft.com/fwlink/?LinkID=322105. The
missing file is ..\packages\Fody.1.26.1\build\Fody.targets.
When I run Get-Package, it says no packages are installed.
How do I get rid of this(I have no need for the package anymore).
Thanks
You don't want to use the project based nuget package restore!
Make sure you have the latest Nuget version (Tools -> Extensions and Updates)
When you go to build the project it should tell you it needs to download the nuget packages (or might just auto download them).
Edit not sure whats with the downvotes:
http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
To find the menu item: "enable nuget package restore" right-click in the solution explorer on the solution - not on the project.
You get a message:
Do you want to configure this solution to download and
restore missing NuGet packages during build?
Press Ctrl+Q then type "Package Manager Console", This will bring up a console like interface.
Type in
Uninstall-Package Fody
and press enter will remove this package for you

How to use NuGet?

I have installed NuGet, how to use it?
I saw the video and i tried
>Add-Package log4j
Command "Add" is not valid.
>
it does not work, I entered that in Command Window.
EDIT:
I uses VS2010 and I build WindowsForm App and not ASP.NET.
You've got two options;
You can either use the GUI; right click on project references > Add Library Package Reference...
Or you can use the console, which has more features, but I'd not recommend it.
You're entering this in the Command window when you should be entering it in the Package Manager Console window. Open it through 'View' / 'Other windows' / 'Package Manager Console'.
To answer your specific question besides the documentation link:
Using the Package Manager Console you can find a package by filtering it i.e.:
get-package -remote -filter Log4net
Once you find the package you want, you can add it to your project with
install-package log4net
That's all there is to it - if you don't need to use the console then for casual use the Add Library Package Reference Dialog Box (that's a handful) provides an easy to use UI to add packages.
Click on project --> Manage nuget packages.
You can see this youtube video which shows the importance of Nuget and how to use by using VS 2012
http://www.youtube.com/watch?v=AXfZsTj-7P0
If you have visual studio 2013 or above.. the solutions now come up with Nuget package manager and a packages.config file is also added to the solution. packages.config file contains information about all the packages present in the solution.
Read more > About Nuget Install/Uninstall & Downgrading

Categories