How can we generate the build file from VS.NET - visual-studio

If i have a VS.NET 2008 solution , and i want to export the build script so that i can use it to build the same application in another environment which does not have VS.NET, how can i extract this make or build script from the VS.NET ?
Thanks.

If your solution consists of .csproj or .vbproj, it is already a build script with MSBuild as the build engine. MSBuild comes with .NET framework, not with Visual Studio.
Edit:
You can launch MSBuild from the following locations:
%windir%\Microsoft.NET\Framework\v2.0.50727
%windir%\Microsoft.NET\Framework\v3.5
%windir%\Microsoft.NET\Framework\v4.0.xxx
Starting with version 3.5 of the tool, you can specify the target framework for which you want to build by specifying the "ToolsVersion" attribute on the project element.

Related

TFS XAML Build Console App

I'm using TFS2017 and VS2015.
I have a solution with multiple WebApps and a ConsoleApp.
When I do a TFS build I get the WebApps built and dropped to the location I need. but so far I have been manually copying the ConsoleApp.
Is there a way for TFS to build the ConsoleApp and also drop it in a specific location?
Why you have to use the Xaml build system? See Why You Should Switch to Build VNext
In TFS 2017 you can easily use the new vNext system to build the ConsoleApp and drop it in a specific location.
You can build the entire solution with VS build task or separately build the ConsoleApp projects with the MSBuild task with the MSBuild Arguments set e.g : /p:OutDir="$(build.artifactstagingdirectory)\\"
Then use the Publish Build Artifacts task to drop it in the specific location.
You can use a PowerShell script as post build script in a xaml build and use it to copy files to the build output. Sample script for XAML builds available here

Integrate advanced installer Merge Module project with Visual studio

I have some merge module projects created using advanced installer. I need to integrate them with visual studio. I have done same for MSI projects and they work fine. but I don't know how to achieve continuous integration for MSM using Visual Studio.
Advanced Installer extension for Microsoft Visual Studio allows to create Advanced Installer Projects for Visual Studio. Each such project is a container that can include a single .AIP file.
The Visual Studio Solution can include one or more Advanced Installer Project for Visual Studio, in accordance with your needs.
Note that you need to remove the default project that is created when adding a new Installer Project to the .sln and add the existing project, the project that builds the .msm package.
edit
Indeed, you are right. It was a misunderstanding on our end.
On my machine I have several extensions installed side by side. One of these extensions also supports the build of a merge module project type.
We do not officially support this yet. The option to build other project types (e.g. Merge Module Project, Updates Configuration Project) with our VS extension will be available in a future version of Advanced Installer. I will let you know when we will add support for this.
Until then, you can use a build event as a workaround to build the Merge Module Project within the Visual Studio project.
To build the .msm project you can use a command line as described below:
http://www.advancedinstaller.com/user-guide/command-line.html#build-project
The command line can be something as below:
AdvancedInstaller.com" /build "$(SolutionDir)Merge module sample.aip"

How to build two version of .net framework at one click on visual studio

below is what I want:
There are several versions of .Net Framework, like 3.5 and 4.0. Is there a way on Visual Studio to click the build button and get two built .exe or .dll files?
I know there is "Batch Build" in Visual Studio to build several .exe at the same time, but I can create different build configurations. But I cannot assign different build configuration with different .Net Framework version and get the build result at the same time. Did I miss something or is there any work around?
Thanks a lot.
To do this you should have one Major project that develop on one it. its version is 3.5
create another project and add first project files to it. after build the solution you have two version of compilation from your code.
to have a clean work you can use Post-Build event to copy output files to another directory.
ask me if any point is not clear

Integrating MSBuild into Visual Studio

I'm a solo developer running Visual Studio 2008 and looking into MSBuild to improve my build process.
Almost all of the tutorials I've found so far have plenty of information about writing a build file. However I'm having a lot of trouble finding out how to integrate MSBuild into Visual Studio. Maybe MSBuild is only used with something like CruiseControl but that's overkill for me as a single developer.
Where should the build file live in a Visual Studio project and how can I run it from within the IDE?
Visual Studio executes MSBuild automatically for projects it supports.
If you right click on a project and unload it, you can then edit it in Visual Studio. Reload (right click on project again), force a (re)build to test your changes. An alternative is to edit the project file in an external editor and Visual Studio will detect saves and offer to reload the project for you.
Sounds like you're on the right track, and if you are considering writing Targets or custom MSBuild Tasks, take the time to separate them from your current project so that you can re-use them. Don't re-invent the wheel though, the two main complementary MSBuild projects are MSBuild Community Tasks and MSBuild Extension Pack.
Update: Judging from your comment on Mitch's answer, you might also want to consider adding a new Configuration element or custom properties to a project. A new MSBuild Configuration (something other than the default Debug/Release) could run unit tests, build documentation, or whatever you want automated. A custom MSBuild property would allow you to use normal Debug/Release Configuration and extend it to automate more of your build process, just depends on what you want. Either approach could also be driven from the command line.
As others have noted, MSBuild is already available when you install Visual Studio.
If you want to integrate into VS2008: Running MSBuild from Visual Studio
MSBuild is the build engine used by Visual Studio to process the files included in a project.The Visual Studio project files themselves (**.csproj* for C#, and .vbproj for VB, for example) are in fact MSBuild scripts that are run every time you build a project.
Your .csproj file is a MSBuild file. So you are actually using it already.
You may of course wish to create a separate build file to have more control, especially within a continuous integration or nightly build say.
If you simply wish to edit your project build file then you can use the IDE to edit some settings such as pre and post build actions or edit the Xml itself by unloading project and right click and editing.
You can use your current .vcproj files to build your project with MSBuild. However, as MSBuild is not directly supported (at least for vc++) vcbuild is used instead (internally).
In VS2010 all project files are MSBuild based...
This is an older article about some simple extension points from the msbuild team
How To: Insert Custom Process at Specific Points During Build
Also, don't forget you can use the MSBuild SideKick for developing and debugging your (local) msbuilds, available for free at http://www.attrice.info/msbuild/
I'd suggest you call msbuild as a post build step. Then you can put your build script somewhere in your solution and call it.
<windowsdir>\Microsoft.NET\Framework\v3.5\MSBuild.exe c:\temp\MyProject\mybuildfile.proj
The easiest way is probably to invoke your custom build script using a post-build step. Right click project, choose "Build Events" and call msbuild with your custom msbuild file from there.
I use the msbuild template to intergrate with visual studio
http://msbuildtemplate.codeplex.com/

Is there a Visual Studio C# equivalent of the Visual Studio C++ Makefile project

In Visual C++ inside Visual Studio, one of the project subtypes is a "Makefile Project".
But there doesn't seem to be an equivalent for Visual C# inside Visual Studio?
BTW, a Makefile project is:
If you have a project that you build from the command line with a
makefile, then the Visual Studio development environment will not
recognize your project. To open and build your project using Visual
Studio, first create an empty project containing the appropriate build
settings using the Makefile Project Wizard. You can then use this
project to build your project from the Visual Studio development
environment.
The project displays no files in Solution Explorer. The project
specifies the build settings, which are reflected in the project's
property page.
The equivalent of make in Visual Studio world is msbuild. Visual Studio does not use make. .csproj, .vbproj etc. are input files for msbuild. You can do pretty much the same stuff in them as in conventional makefiles, including command line building, custom targets etc.
There's nothing C++-specific about the Makefile project type; it just runs a command line. It's just that it's listed along with the Visual C++ project types. You can add one to a solution that otherwise contains nothing but C# projects.
Alternatively, you could set up a pre-build step in your C# project that directly runs nmake, msbuild or even NAnt.
Msbuild is what is used to build your projects when you hit the Play button. Personally I like NAnt + NantContrib it was easier for me to pick up and start using right away. For all new projects I use tree surgeon this tool creates a default build script and proper build tree with testing project and code coverage report.

Resources