I have an ASP.NET MVC 3 application. This application is hosted in TFS. I have setup a build server. When a checkin happens, my code is complied and dropped in a folder on my test server. The drop folder is an IIS application folder. The goal is when a user visits http://[myTestServer]/MyProject, they should see the latest compiled version of the app. In an attempt to do this, I'm dropping files in //[myTestServer]/c$/inetpub/www/myProject/. However, I'm getting more than I bargained for.
I've noticed that the build server puts a bunch of assemblies and creates 2 directories: _PublishedWebsites and logs. _PublishedWebsites contains two directories: MyProjectName and MyProjectName_Package. From what I can tell MyProjectName contains the files that I want put in //[myTestServer]/c$/inetpub/www/myProject/. What am I doing wrong?
How do I setup it up such that when a user visits http://[myTestServer]/MyProject, they see the latest compiled version of the app?
Have a look at Microsoft's Web Deploy for deployment of Web applications and Web sites to IIS servers.
This tutorial describes in detail how to configure TFS for Web Deployment:
Configuring Team Foundation Server for Web Deployment
Creating a Team Project in TFS
Adding Content to Source Control
Configuring a TFS Build Server for Web Deployment
Creating a Build Definition That Supports Deployment
Deploying a Specific Build
Configuring Permissions for Team Build Deployment
Related
I just set up a new TFS CI/CD process for an existing project. How do I set up the release so it would deploy to the existing Site folder in the IIS instead of the Application Pool? Using TFS 2018 release management process. This is not an azure pipeline project
For your situation, you just need to specify the existing Website name in IIS Web App Deploy task step, then it will automatically update the website once any changes are checked in with the CI/CD definitions set.
Assuming the Website name is ApplicationToDeploy, just specify the name under Deployment > Website name
Just need to make sure the website is existing there, you could check this info in IIS manager.
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
When we deploy our ASP.NET MVC application all sources, controllers, views, etc. are copied.
This is not a problem when we deploy on our server, but when we are going to deploy a copy into external servers and we don't want to share our code.
Does not exist a tool to package into libraries? .NET Core seems to deploy into DLL files, but I don't find that functionality on ASP.NET MVC.
Does not exist a tool to package into libraries?
Yes.
This is what publishing the application does - it prepares the application for deployment. When you publish, it will compile the source code and prepare only the assets your application needs to run into a deployment folder.
It compiles the source into libraries. Views are only compiled if you use the precompile views option, otherwise they are distributed as files.
Use the Publish tool to deploy to a local folder. The exact options available depend on your app type. In Solution Explorer, right-click your project and choose Publish, and then choose Folder. For more information, see Deploy to a local folder.
Tutorial: Publish your Hello World application with Visual Studio 2017
You can combine publishing with IIS Web Deploy in order to easily automate the process of deploying your web site.
We use TFS 2012 as our Source Control Repository and we also use it to deploy our Web Applications (primarily ASP .NET MVC applications with Entity Framework Code First Databases) using TFS Build and Deploy from Team Explorer within Visual Studio.
Our's is a fairly small and new setup, so up until now, we developers have been deploying code to the production servers. But from an Audit point of view, it has been decided that code installation will be handed to a separate group. At the moment, before we deploy code using TFS Automated Deploy we do a couple of steps which are manual steps
- Log on the production server, backup the individual application within IIS using IIS --> Export to export it to a zip file.
- Stop application pool for the IIS application where new code is being installed
- Install new code from Visual Studio --> Queue new Build
- Get back on the server to restart the application pool and do tests to see if the application is working as expected.
I wondering, if anyone can guide me, if there is any way to change the Automated Build and Deploy template / process / workflow to do these manual steps before it does these steps before and after it deploys the code? Basically, the new team doing the code install to the Production Server and they will still click and install code automatically but the buid templace / process / workflow will do these steps as a part of the Build / Deploy process.
thanks
if you can code it, Powershell, bat etc. then you can add it to the template.
Identify where in the workflow you need to add your new steps. you can then add an invoke process activity to call out to your scripts, that will do the currently manual steps.
I would have thought most of the IIS steps can be automated using powershell and iis appcmd
Also it may well be worth looking at Release Management 2013 as your deployment pipeline, it will give a more Auditable stream and allow for sign off to approve deployments. http://www.visualstudio.com/en-us/products/release-management-for-microsoft-visual-studio-vs.aspx
I am using the web publish procedure in VS2012 to deploy my MVC 4 project to a remote IIS server. This works fine when publishing a debug configuration. However, when I try to deploy a release configuration, the build fails. The setup is that I use the MVC 4 framework, but I have all my controllers in a separate F# project. The controllers consume web services that can be accessed by using a client library that generates the clients using F# type providers. When the release configuration is building I notice multiple errors because the wcf types are no longer valid. Yet, the lib providing these types has been build al ready.
Using exactly the identical setup but changing the build configuration to debug (in the web publish dialog under settings), I can publish the solution without any problems.
Try to delete the obj folder before publishing using the release config.