I have been doing some work recently with publishing mvc applications on visual studio 2012. I have been using publish profiles to configure web deploy to different environments. I have also been using web transforms to transform my web.config as per each of my publish profiles.
In a package, is there a setting to ensure the server its getting installed on wipes previous installed content from the previous install?
As an aside from the above, is it possible to package an application and not have it perform the transforms until gets deployed? Therefore the package is independent of the target server (dev, qa) and can installed on either.
You can deploy an existing package using publish profiles with some custom MSDeploy magic. However, I've not tried to hold onto web.config transforms and gone with MSDeploy parameters completely. It's worth attempting, but I've not tested my custom script with them so there may be some targets that I've forgotten.
I still use web.config transforms, but only to remove non-debug elements when creating the package (with a Release transform)
Related
We have developed a ReactJS web application and we want to host this application on IIS. The application successfully runs on IIS. Now, it is time to upgrade the application. Instead of manually copying the files to IIS folder, we want to simplify the deployment process.
How can we deploy the build package that is generated using command npm run build onto IIS web site using WebDeploy protocol?
(Note: IIS has already been configured to accept and successfully executes WebDeploy requests, such as Visual Studio MVC project outputs.)
It may be difficult to implement it, because web deploy often requires visual studio to package the application, which is different from the direct build of reactJS.
More deployment of ReactJS is to copy to remote IIS after the build is completed.If you insist on using web deploy, first you need to combine it with visual studio, packing the ReactJS after building.Then use powershell to deploy the package onto the remote server.
My preferred method is to use Azure DevOps. It is simple and easy to use, especially for the subsequent upgrade and deployment needs of your application. It can be deployed remotely, and it is also very convenient to upgrade and iterate after deployment.
Azure Pipelines
I'm assessing moving from TeamCity to VSTS and there are two steps I have in my pipeline that I'm not sure how to setup in VSTS.
How do I include 3rd party dlls in my build? Currently we use a tool that must be installed in the Developer's computers that has separate dlls for x86 and x64. The x86 are included in the project and are needed for the designer, but the x64 are copied from the Program Files folder with an after-build command in Visual Studio. For it to work in TeamCity the tool was installed in the server, so the same after-build command copies the dlls into the build directory as in any other developer computer.
I don't see a way to achieve this in VSTS without including the x64
dlls in the source code, which isn't desirable due to the tool's
license.
How do I publish to SVN? Currently our binaries are hosted in an SVN server. In TeamCity I have a PowerShell script that (in short) updates the SVN local repo in the server, copies all the files from the build directory into the SVN repo and commits the changes.
Storing your dependencies
Lot's of options available here:
Put them in a NuGet package and store them in VSTS Package Management. Have your build restore the package during build.
Put them in Source control, either SVN or TFVC and fetch them during the build.
Store them in Azure Blob storage and fetch them on-demand by downloading them at the start of your build.
Use a custom build agent (Azure VM?) and install the software and the VSTS build agent onto it.
Store them as Build Artefacts in one Build Definition and fetch them using the Fetch Build Artefacts task, which is available from the marketplace.
I'm not sure what kind of license issues you're facing, but I'd expect that each has the same issues if you're not allowed to put the binaries anywhere other than on a licensed machine. Maybe the vendor offers a better option or can be persuaded to offer a Cloud/VM license option.
Publish to SVN
I don't see why the same PowerShell script couldn't be used. Though I'd recommend not to alter your repository from the build pipeline. It makes future CI/CD scenarios much harder. You can attach the binaries as Artefacts to VSTS Builds and that way they can also easily be linked to Release pipelines. You may need to fetch the latest version of svn and store it somewhere in order to run your script. When running on a Azure VM, you can simply install SubVersion directly to the agent.
There is no built-in task available.
I'm learning about the environments and machines of Octopus. I have a Web project that is packaged into a Nuget package and deployed to Azure Websites, and I also have a DB project that is packaged into a separate Nuget package to SQL Azure. When Octo picks them up and deploys, is it better to have two separate machines have tentacles for each in the same environment, or should they be on one machine (in the case that the website deployment passes and the DB doesn't)?
If you're deploying to Azure, it doesn't really matter - 1 tentacle is enough for ALL environments (regardless of project type). We do this all the time for our Azure projects. You can think of the tentacle being a PowerShell script runner against Azure; nothing really happens on the actual server itself.
You can have multiple Octopus "environments" using the same tentacle (especially for Azure) - as you can reuse the same tentacle. This will allow you to use different scopes for your variables to apply the appropriate values per each logical environment, all the while targeting just one server which does runs scripts against Azure.
I have deployed an Website built with angularjs and a Web Service Running Nancyfx framework rather than the "suggested" Web Api. I also use 2 SQL Databases.
I did this from Visual Studio where I have my project running. However the app (still in development) was developed locally on my mac and then just copied in visual studio.
Since I would be working with a friend of mine on it (who also uses mac) and we already have it on bitbucket with Git (my local version) I was wondering if it was possible to 'Set up deployment from source control' but only for the "website" part, meaning the angularjs. The web service needs to obviously be deployed from Visual Studio (I'm the only one working on that part).
Is there any way to achieve this? If I set up deployment from source control and then publish to the website from visual studio, would this override the existing version and current deployment last updated from Git? will it get denied publishing since it's set up from Git?
I am not sure how to better approach this.
The dirty way would be to set git for me and my friend on my local "app" folder of my Visual Studio solution so that I get his changes and then it's my job to publish it to azure via Visual Studio.
Turned out that what i needed is exactly this: Publish WebAPI and MVC projects to same Azure Web Site?
I therefore split my webservice (API) project so it's by itself and published that to mywebsite/api while my app resides on mywebsite/app so that I can publish my webservice changes from visual studio without problems, and also publish the changes to my angularjs app via git.
I haven't encountered any downside atm of doing this but it seems this is the best approach.
In Visual Studio 2010 there is a nice feature of the database project that allows you to deploy to a database as well as set up various environments based on your configuration (Build deploy etc)
I Would like to integrate this into our automated build environment.
Firstly by having the deploy script run after a successful build on my local machine. (So I can go straight into running the unit tests)
Then by Having the deploy script run after the successful build on our build server. so that any schema changes required for the unit and integration tests will run.
How can I adjust the MSBuild or similar to run these in deploy mode.
Use the MSBuild task to call the "dbproj" file. Pass "DBDeploy" as the target and the build configuration as a property, e.g.:
<MSBuild Projects="MyDb.dbproj"
Targets="DBDeploy"
Properties="Configuration=$(Configuration)" />
On a build server, you might also need to supply properties like TargetConnectionString and TargetDatabase.