Location on nant build file in Visual Studio solution - asp.net

I am just starting to use Nant and have a quick question -
When using Nant with a ASP.NET web application, where is the recommended place to put the build file? Should it be part of the web project or should it be just directly under the solution? Am I over thinking this?

I recommend you to place your build file along with the whole project. You also should create a separate directory for this build file (e.g. named Build), because in future you will have to create one more build (or .include) file and one more and then you will have a set of build files that should be grouped.

Related

How to deploy solution with multiple web projects with VSTS?

I have a solution with multiple web-projects and many class libraries.
I want to deploy web-projects to my own VM with installed deployment agents.
Should I create for every web-project separate its own Build and Release Definitions, right?
Obviously, creating separate Build and Release definition for each web project works. But if you want to use one build & release definition, it also can be achieved, and there are many ways.
For example, if you want to use each project artifact, you could use individual project files in the solution to build in Build definition. Or you could copy the file you need for one project in Release definition, etc. In a word, it depends on how do you want to achieve your requirement.

Automatic build/deploy of ASP.NET CMS modules using TFS2010

We are using a CMS system which is not included as part of our Visual Studio solution. When we develop for the CMS, we create individual projects within the solution for:
Widgets
Templates
Masterpages
Controls
Each of the projects has a designated destination folder within the CMS, so the website looks like this:
\\mywebsite\controls\mycontrol.ascx
\\mywebsite\templates\single-column-template.aspx
\\mywebsite\widgets\tabbed-content.ascx
\\mywebsite\masterpages\main.master
And each of their compiled assemblies need to go in \\mywebsite\bin\
Each time a project is built within the Build Definition's process template, MSDeploy is called, but I cannot get MSDeploy to place the .ascx, .aspx, and .master files into their corresponding subfolders while also having their assemblies placed into the bin.
Within the Build Definition's MSBuild Arguments, I have the following string:
/p:DeployOnBuild=true /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl=myserver:8172/msdeploy.axd /p:AllowUntrustedCertificate=True /p:DeployIISAppPath="myserver/mywebsite" /p:Username={user} /p:Password={password}
If I modify the /p:DeployIISAppPath to be /p:DeployIISAppPath="myserver/mywebsite/controls", then MSDeploy creates a bin folder under that subdirectory, so using a custom parameter during the build process doesn't seem like it will work. Can anyone help me understand how I might be able to accomplish this?

MSBuild - Perform all config transforms at once - and transform other files

I have been working on a build script for a website that we have. The website is a classic asp web app with an asp.net website in a folder of the classic asp web app.
We have different versions of the global.asa that need to be substituted instead of different web configs. We are in the process of moving to a continuous integration environment so much of this still new to me. I've written a build script that performs the following tasks.
Cleans the buildartifacts directory if it exists.
Builds the solution file with whatever configuration is passed in. This produces output with each project in a separate folder.
Copies the files into the required folder structure.
Packages up the result using MSDeploy as sync.
My first problem is this ...
When I run the MSBuild task like so ...
<MSBuild Projects="$(SolutionFileName)"
Properties="Configuration=$(Configuration);OutDir=%(BuildArtifacts.FullPath)" />
It builds the web app but does not apply any transformations. I would have assumed that MSBuild would apply the transforms automatically. Instead I end up with all 3 config files in the output folder that contains the build. Why is this? I've done some searching here, and here and they are using a separate task to perform the transformation. IF Visual Studio can apply the transforms and Visual Studio uses MSBuild I would think that MSBuild could apply transfromations? Isn't MSBuild configuration aware? Also if I have to do it separately, can I perform all transformations at once, if there are multiple config files in multiple folders at each level of the folder structure.
My second problem is ... being a classic asp web app we can't really use config files for this part of it because ... well I'm not sure how the classic asp web app would access the config file? So we have different versions of the global.asa file that would normally get replaced manually. I suppose I could do some sort of search / copy the specific asa files that we require at that time, but is there a way to perhaps use transformations to do this task?
Maybe this is not exactly what you need. I'm using XmlPreprocess tool for config files manipulation. I'm using one mapping file for multiple environments. You can edit mapping file by Excel. It is very easy to use.
You can call it from MSBuild script using Exec task.
Regarding the issue of transformations ... once we sorted out deployment with msdeploy we found out that msdeploy will actually perform the transformations on deployment. It stores the transformation data in one of the xml files that get created with the package.

Is it possible to run ILMerge at compile time within SharpDevelop?

I'd like to offer my .Net library (which I'm developing in the SharpDevelop IDE) as a single dll. I've been manually using ILMerge to merge my compiled library and all its reference libraries together, but would like this done automatically.
I'd ideally like to have this automatic merge happen from within SharpDevelop, without having to set up an external build script. Is this possible?
SharpDevelop uses MSBuild to compile your code so the simplest way would be to create a post build step that runs ILMerge with the correct parameters. You can create a post build step from the Project Options under the Build Events tab. Alternatively you can directly edit your project file in Notepad.

Typed DataSets in WebApplication Projects

I am converting an older C# Website Project into a Web Application Project so that we can better manage it in our source control system. I have run into a problem.
The Website Project used strongly-typed-datasets (i.e. .XSD files). There is C# code written that uses these strongly typed datasets as an object. That worked fine when it was a Website Project but does NOT compile now that it is a Web Application project. The compiler can not find the reference to the datas set because datasets are not compiled.
Is there an easy solution to this problem?
You could use XSD.exe on the command line to generate the dataset classes into a class file and add the file to the new project.
xsd.exe StronglyTypedDataset.xsd /dataset
This will generate the file "StronglyTypedDataset.cs". Use the /namespace:My.Project.Namespace flag if you need to put the dataset classes into a specific namespace.
This is essentially what's going on behind the scenes in your website project.
There's a nice guide to integrate XSD compiler into Visual Studio (2003 - 2010). It might help you automate the process: http://wiki.codesynthesis.com/Using_XSD_with_Microsoft_Visual_Studio#Visual_Studio_2010_.2810.0.29
Another approach that worked for me when converting into a Web Application Project was to remove the .xsd file from the project and include it again.
VS 2008 automatically defined the "Custom Tool" property to use (MSDataSetGenerator) and re-creates the *.designer.cs file for me every time the xsd change.

Resources