简体   繁体   中英

Azure web app publish with Visual Studio - not including all files

I have an MVC project being published to Azure from Visual Studio as a web app. In the solution I have a project set up as a "plugin" which is used by the web application and installed using Unity DI. Locally this works but when I publish to azure the plugin files aren't being deployed. This is how my solution and project structure is setup:

Solution MyProject
    >nuget
    >...
    >Plugins
        >Plugin.Widget.GoogleAnalytics
    >MyProject.Web
        >Properties
        >References
        >...
        >Plugins
            >bin
            >Plugin.Widget.GoogleAnalytics (excluded from project but copied to this directory after project is built above)
        >Views
        >...
        Web.config

Running locally if I delete Solution MyProject/MyProject.Web/Plugins/Plugin.Widget.GoogleAnalytics after is compiled the plugin doesn't appear. If I copy the contents of Solution MyProject/Plugins/Plugin.Widget.GoogleAnalytics/bin back into Solution MyProject/MyProject.Web/Plugins/Plugin.Widget.GoogleAnalytics , the plugin reappears.

The problem is, when I publish to my azure web app, it doesn't include Solution MyProject/MyProject.Web/Plugins/Plugin.Widget.GoogleAnalytics . If I FTP that directory up from my computer is still doesn't load it after restarting the app.

I've tried to include Solution MyProject/MyProject.Web/Plugins/Plugin.Widget.GoogleAnalytics in the project but it causes compilation problems since it's supposed to be added by DI and it also doesn't work after publish.

Is there a way to include the necessary files (not included in the project) during a publish so what works locally will work on azure? Or is there another way to go about this.

If I don't check the option on publish to Remove additional files at destination it usually throws this error when the site tries to load:

Method not found: 'Microsoft.Practices.Unity.IUnityContainer MyProject.Core.ContainerManager.GetConfiguredContainer()'

I've tried to debug that but it's very difficult since it only happens on the azure web app.

I found this question but it didn't give any information for this issues.

EDIT I was able to get the plugin to work on azure by following these steps. 1) Run in dev environment locally in Debug mode. 2) Publish to azure as debug build. 3) FTP web application plugin directory to azure. 4) Restart azure app. It runs in azure but it's a debug build. 5) Publish from local dev environment as release build.

After this, I was able to publish as release build and check Remove additional files at destination . This removes the plugins in azure. Then I FTP'd the web application plugin directory to azure and start and stop web app and it works. Maybe I can take the debug steps out of this but this is working now.

Heinrich,

Can you please try this below step and see it works.

  • Make sure you set the build action to Content and they will get deployed.
  • Try deploying in release mode.

Hope it helps.

MV

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