Can you create Build and Release Definitions for Website projects not Web Applications in TFS2015? - asp.net

Is this possible?
We currently have build definitions and release definitions setup and working for Web Applications. However we have a lot of older web site type projects and will not work with the current build and release definitions that we already have setup.
Is there a way for us to get the web site projects to work with the build and release definitions in TFS?
Thanks
Recently changed my steps for the build definition and now that build is successful but the release still fails.
Build definition Steps are:
Nuget Installer, Copy Files, and Copy and Publish Build Artifacts
Release definition Steps are:
Powershell on Target Machines, and Windows Machine Files Copy

As web site projects needs bin folder and TFS doesn't want them to be stored in source, the best way to achieve is to convert web site projects to web application.
Best practice: Converting to web application:
https://msdn.microsoft.com/en-us/library/aa983476.aspx
But they made a workaround maybe you can try:
https://blogs.msdn.microsoft.com/tfssetup/2016/09/21/building-a-website-with-tfs-build/

Related

MSBuild how to create a web deploy package for .NET Core apps without producing zip file

So what I'm trying to do is build a .NET Core app with MSBuild, and have it create the web deploy folder but without automatically putting it in a zip file. I can do this for .NET Framework apps by using /p:WebPublishMethod=Package and /p:PackageAsSingleFile=false, it creates the same folder structure but without adding it to a zip file. However with a .NET Core app, it seems to ignore this flag and always zips up the final package.
The reason I do not want it zipped up is I need to add a number of "custom" files to the build before I can deploy it. I can't add the files during the build itself because we have a number of different clients, and they all share the same "base" software, and then the client specific files need to be added afterwords. So I want to build the "base" software, then be able to copy the output folder, add the client specific files, and then zip up that build to be deployed to IIS. This saves a tremendous amount of time because the alternative is doing a new build for each client, even though 95% of the software is the same.
So is there a different way to accomplish this with .NET Core apps?
I've been testing with MSBuild via command line. The solution has a mix of .NET Framework and .NET Core asp.net websites. This is what i'm running:
msbuild.exe "Solution.sln" /nologo /nr:false /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PreBuildEvent="" /p:PostBuildEvent="" /p:BasePackageLocation="C:\Temp\BuildOutput" /p:platform="any cpu" /p:configuration="release"
This works for the .NET Framework websites, but the .NET Core websites continue to be zipped up
And just a note that the BasePackageLocation is a custom property that sets the PackageLocation to "$(BasePackageLocation)\$(MSBuildProjectName)\" so that each website is put in its own sub-directory
So is there a different way to accomplish this with .NET Core apps?
Sorry but the answer could be negative. This is one issue about publishing .net core projects, it has been reported to Product Team, there might be a long way to go before the fix.
For web deploy package mode in .net core, you'll get WebApplication.deploy.cmd in the same folder where the .zip exists, many commands in the xx.cmd are associated with the xx.zip, so it's not recommended to manually do something to unzip it.
I suggest we can track the issue there(DC) and I will update the answer if there's any update or fix :)

using visual studio team services to build a solution containing multiple web apps and deploy these web apps to azure

My team uses Visual Studio Team Services to manage our source code in a TFS repository. The solution contains multiple web apps. I am trying to configure Continuous Integration and Continuous Deployment for this solution such that each web application is deployed to the correct Azure web app after a successful build. I've configured the BuildDefinition to build $/MyProduct/MAIN/MySolution.sln. I've defined the following parameters to MSBuild based on some MSDN articles I found on this subject:
/p:DeployOnBuild=true
/p:WebPublishMethod=Package
/p:PackageAsSingleFile=true
/p:SkipInvalidConfigurations=true
/p:PackageLocation="$(build.stagingDirectory)"
The build steps include a Visual Studio Build step, a Visual Studio Test step (currently disabled to minimize complexity), an Index Sources and Publish Symbols step (which I don't think I really need), and finally, a Copy and Publish Build Artifacts step.
I am able to build this solution using this configuration. I can see the build results, the build log, build details, etc. When I look at the artifacts that are created, I see two artifacts: "drop" and "build.sourceLabel" If I explore the drop file using the Artifacts Explorer, I find all of my projects in this drop file, and for the web app projects, I can navigate into the webapp1\obj\QA\Package\PackageTemp\bin folder and see all the DLL's etc. for the web app.
What I don't see is one zip file per web app, which is what the Release feature of Visual Studio Team Services is expecting.
I would like to know how to modify my current configuration so that I can generate the correct artifacts from the Build step so that I can create the correct Release Wep App Deployment tasks to deploy each web app to the correct web app in my environment.
This is all being done with Visual Studio 2015 and Visual Studio Online (Team Services).
To test your situation I used Visual Studio 2015 and created 3 new web projects in the same solution and checked into VSTS. I then created a new build using the Azure Website deployment template. Many people miss that we have Build and Deployment templates on the Create New Build Definition dialog. The reason I use the Azure Website template is because I can never remember the msbuild arguments to pass in. You can simply delete the Azure Web App Deployment task if you are going to use RM.
One change I always make to the msbuild arguments is the PackageLocation. I always change mine to $(BuildConfiguration). That way I can build both Debug and Release at the same time should I desire.
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(BuildConfiguration)"
Finally I change my Copy and Publish Build Artifacts task to search for just “**\*.zip”. Leave the Copy Root empty and run your build.
When your build completes you will have one zip per project under the [ProjectName]/[Configuration]/projectName.zip when you explore your artifacts.
If you have further questions you can ping me on Twitter #DonovanBrown

Configuring existing ASP.NET project for DNVM, DNX environment on a Mac

I have an ASP.NET Web API project created on Windows using Visual Studio. How can I set this up for use with DNX/DNVM (on a Mac)?
Switching to Git solved the source control compatibility with TFS. But I wasn't able to find references to getting a project working across both these development environments.
I'm assuming as a first step the project will have to be migrated to ASP.NET 5/vNext but wondering other problems lurk around the corner with different project members using different environments.
I get an error when I run - git:(master):dnx . kestrel
As you mentioned yes you will have to migrate any namespace changes. I have a project that is developed across both. Also changing csproj files to xproj. Support is coming for some kind of interop between the different project types but its not here yet.
For build, publish, deploy from git without relying on VS publish capabilities or MSBuild you can follow my blog post here.
Basically you use DNU to publish and then kudu to deploy.

Should I use the aspnet_compiler with a website project?

We use Nant and devenv.com to build all our assemblies including the website project. Then we would use aspnet_compiler.exe to compile the published website.
Is this the correct way to do it? Historically, we always used the aspnet_compiler with plain vanilla website folders, but I'm not sure if this is really the correct tool for publishing websites that are part of a website project. It sort of feels wrong to have to do this as a 2 stage process using 2 different tools.
Using aspnet_compiler.exe is one of many ways to publish a website:
http://forums.asp.net/t/1544792.aspx#_What_is_the1
Since a web project can be compiled using msbuild (instead of devenv.com), you can also create a custom msbuild target to publish your files:
http://www.digitallycreated.net/Blog/59/locally-publishing-a-vs2010-asp.net-web-application-using-msbuild
In this way, you can combine the compiling and publishing of the web site in one step.

asp mvc deployment with msbuild and rake

I have an asp mvc project. I'm wondering, what's the difference between building the solution and then copying bin and all other views/scripts/images/style sheets and publishing (besides the obvious work of copying files). I'm asking because i want to automate my deployment with rake and I can't use web deployment because it's not compatible with mono.
Depending on your version of Visual Studio and settings, Publishing typically does two main things in addition to the build
Packages the solution
-- usually into some standard format (WebDeploy, Web Project)
Automates deployment
-- typically hooks something like MSdeploy ("web deploy") to synchronize the site with a local or remote IIS setting
So in terms of what you are deploying, there is no difference. The build and output files are the same. Publishing is simply allowing a developer a simple path of packaging + deploy, which you are handling with rake.
BTW Have you looked Uppercut this tool could be very useful in your build process.

Resources