Include OpenXML assembly when publishing - asp.net

I've got an ASP.NET MVC 5 project with a reference to a class library project which is using OpenXML installed via NuGet.
Install-Package DocumentFormat.OpenXml
It all works on my development machine. But when I publish the OpenXML assembly (DocumentFormat.OpenXml.dll) is no where to be found on the server.
What do I need to do get it included when I publish?

You should set copy to local to true for that assembly file. To do that, right click on the reference file (which is showed in your image) and then click "properties". In the showed window you can find it.

Try removing any instance of DocumentFormat.OpenXml.dll from your workstation's Global Assembly Cache (GAC).
Open the GAC root in Windows Explorer (Win 7: %windir%\Microsoft.NET\assembly)
Search for OpenXml
Delete any appropriate folders (or to be safe, cut them out to your desktop in case you should want to restore them)

remove the dll and add is a nuget:
Install-Package DocumentFormat.OpenXml

Related

How to install ASP.NET MVC 5 on a server?

I just updated my website from MVC 4 to MVC 5.
Now when I want to run it on my web server instead of my development machine it does not work.
It think it is because I need to install the MVC 5 libraries on the server but I can't find them.
I downloaded WebMatrix 3 hoping it would provide a way to install it but it only gives me the ability to install MVC 4.
What should I install to be able to run a ASP.NET MVC 5 application?
(without installing Visual Studio 2013)
EDIT:
I disabled custom errors and eror what I have:
Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
EDIT 2:
I found out that the problem was due to one of my dependencies which was using the version 2.0.0.0 of razor.
When you deploy your app just make sure that all the assemblies are being deployed to your production environment in the bin folder. ASP.NET MVC is an xCopy deployment, so you don't have to install anything.
You might want to check that your Production environment has ASP.NET 4.0 and 4.5 registered.
MVC5 and future version of MVC doesn't require to installed on Windows Server. MVC5 app have everything as packages. You didn't need anything to install it.
What is required on server is copy of every library and assembly that you have used in your app. For fix this, Just make sure that everything on your bin folder is called same on server instead of server is looking for it's own GAC for assembly used in your app.
If you didn't found all the packages then you can install nuget packages on server by cmd.
The best is to do a Publish, right click on your project in Solution Explorer and select 'Publish'. Basically it will compile your solution and dump all the assemblies/artifacts to either your webserver, ftp or a local folder.
Make sure all your assembly references are being copied to the deployment directory. To do this you can change the <Reference...> tag in your .project file. Optionally, you can use visual studio's property setter to set the "Copy Local" property of each dll reference to "True".

Including links to external resources in Visual Studio 2010 Web project

I have a ASP.NET project which relies upon the FreeImage .NET wrapper. This is loaded using a reference to a external directory. The wrapper relies upon the FreeImage.dll being present to work (clearly).
How do I get Visual Studio to include a reference to the FreeImage dll. It's not a .NET assembly, i think it was built in something else (so I can't add it as a reference).
I don't really want to have a copy for this project as these files reside in a different SVN repository
Add a pre-build macro/script to copy the file across each time you build. There's no way to add a symbolic link into a visstudio afaik.
I am assuming the .dll was built using a .NET supported language like C#.
You can just right click over the site and select 'Add Reference'.
Browse to the .dll you are looking for and then click 'Ok' to add it.
It should add a .refresh file to your site and the dll. The .refresh file is what is checked into your source control letting the site know the relative location of the .dll to the site.

Restoring web reference in Visual Studio 2008

I had a web reference set in my VS2008 ASP.NET project, but due to some source control weirdness it is no longer listed in the project.
I have the set of files in the Web References folder under my project. There's a .wsdl, .disco and several .datasource files.
Is there any way to re-add this web reference through the existing files rather than using the "Add Web Reference" dialog?
Resolved now.
The project file had all the references in the source control version, but the source control insisted the local file matched the server version.
Digging through the file's history showed that my local version didn't match and an update resolved it.
I think Source Safe needs the repair utility running on it.

system.web.extentions.dll not getting published!

I use the publish option of asp.net 2.0 to create a deployable copy of my web application. Lately I've noticed that the System.Web.Extensions.Design.dll and the System.Web.Extensions.dll does not get copied when using the publish option.
Has anyone any idea why this could have happened?
Couldn't google anything definite about this too...
Thanks.
They're part of the framework, so they are not published.
As others have pointed out they are part of the .NET framework and installed into the GAC which is why they aren't copied in a publish. Visual Studio expects them to be installed in the same location on the deployment target.
That said you can change this, right-click on the reference go to Properties and change the Copy Local to true. This will put a copy of the assembly in the local bin of the website and copy it when you publish.

Attach DLL to ASP.NET Site

How do you attach a DLL to a asp.net site? I want to be able to debug and edit the DLL without having to keep replacing the reference in my asp.net site. I checked attach to process but didn't see the worker process. I am using asp.net, IIS 7.
Just put it into /bin folder of your web application.
OR
Add reference to this .dll by right clicking on References > Add Reference > Browse > Select your .dll file and lick OK.
Then set it's "Copy Local" property to "True". This way .dll will be copied into /Bin folder each time you build application.
alt text http://xmages.net/out.php/i170817_1.png
Using Visual Studio you should create a solution that has your website as a project and the DLL (code) as another project. Make a reference in the website project to the DLL project and it should update it automatically.
If you are not using the web application model and just the website model you could just have your DLL project output to your website's /bin directory directly. That will update the DLL in the website/bin folder whenever you build your DLL project.
If you want to edit the dll, open that project up in a second instance of Visual Studio and treat it like you would for any other project.
Set the reference in your /bin folder to the debug dll that the second Visual Studio creates.
I'm assuming you have Visual Studio...
If you're just trying to add a dll, you can add a reference to it by right clicking on your website node and choosing "Add Reference..." .
You will be able to debug the dll if you have its pdb along with it (to load the symbols from). You will NOT be able to edit the dll.
If the dll is in fact another project you have the source code for, just add the project to your solution, and from your website project add a reference from the "projects" tab. VS should add a reference and dependency so that it keeps the dll updated when you change code in your dll project.

Resources