简体   繁体   中英

Publish dll with website to Azure using Visual Studio

My (C# Asp.net) website works locally, but when I publish it to Azure, it is missing a dll (OpenXML SDK).

After extensive googling, I found that I should set the Copy Local property to True. The thing is though, there is no references node in my solution explorer. Even if I create a new project, and add a few references, there is no references node there. (MS Visual Studio Express 2013 for Web)

解决方案资源管理器

Here is the error:

Parser Error Message: Could not load file or assembly [...] The system cannot find the file specified.

The error is caused by this line (in my Web.config file):

<add assembly="DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Please help me to either:

  • display the references node
  • or manually upload the needed dll (feels odd)
  • or add some magic command to my Web.config to make it automatically upload the used dll-s.

The references node was missing from my Solution Explorer because I chose to create a Web Site, not a Web Application. For Web Sites, the actual physical folder structure is what gets synced to the server. It doesn't have a References node (and, by the looks of it, many other things are missing, since the basic idea is bit different - see this discussion for more details).

There were two solutions for the problem:

  • Converting my Web Site project into a Web Application project ( instructions here )
  • Adding a Bin folder in my project folder (that is the folder with the project name, the on that has my .aspx files in it), and including the necessary dll in that folder

I chose the latter. After publishing the site again, Visual Studio automatically uploaded the Bin folder with the dll inside it, and it worked like a charm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM