Enlighten me please... I have a buildserver that runs MSBUILD to build projects done in C++ Builder 2010. I wanted to setup that entire setup on my local machine to be able to work on the build scripts without messing up the live build server. But I was wondering how MSBUILD knew how to work with C++ Builder projects.
Then I read that a file called Borland.Group.Targets was the magic piece. But I can't find it anywhere. I looked at Embarcaderos site, Microsoft's site, the C++ builder and MSBUILD installations etc. What is it, where do I get it and how does it work?
(My guess is that it's a file with "rules" telling MSBUILD how to handle C++ Builder projects, but that doesn't help if I can't find the file... hehe)
Are you asking how to build a project via the command line? Make a .cmd file like so:
#ECHO OFF
call rsvars.bat
msbuild.exe MyProject.cbproj /t:clean /p:Config=Release
msbuild.exe MyProject.cbproj /t:build /p:Config=Release
Related
I use Visual Studio IDE to develop, VS C++ to compile, CMake to generate the project in VS and Ninja to build.
I have a script that clone a project from git server and automate several steps I need to perform before start working on it.
At the end of this script I would like to open the project in Visual Studio. Before I used to generate the VS solution instead and then use devenv with the sln file as a parameter to open it. But now that I use VS support for CMake if I use CMakeList.txt file as a parameter it only opens this file not the complete project.
Is there a way to do what I am trying to do??
Thanks in advance.
Assuming your project's root CMakeLists.txt is located in C:\project\CMakeLists.txt you can call
devenv "C:\project"
without the CMakeLists.txt.
Note that currently there seems to be a bug in Visual Studio 16.7 that when opening a directory, all the views (e.g. solution explorer) are hidden by default. (https://developercommunity.visualstudio.com/content/problem/1140297/visual-studio-is-forgetting-docked-viewwindow-layo.html)
Any way to replace visual studio's usage of msbuild and still get error reporting in the IDE? I think I might want to compile in VS with NAnt or Rake or PowerShell, or something that is just as smart but uses a scripting language instead of XML. My build is fairly straight forward -- find all the .cs and compile them and put the dll in a Debug/ or Release/ etc.
I'd like to add a number of other steps that just seem easier from the command line:
Like hit the server to prime certain caches.
Compile with Closure
Minify CSS
Generate some metrics after build (in a certain config)
Run NUnit (or custom) testing framework and send an email
etc....
However, I'd still like to get the "error on line" feed back inside of the IDE. Is this a possibility?
You could write some extension for Visual Studio (Macro, AddIn, Package, etc.) that can augment Visual Studio to let other build tools run. The simplest form is probably just using "Tools\External Tools.." and add your Build Tool there. As long as you format your "build messages" as described here, the should show up the output window as if they were generated by MSBuild.
However, I don't think it is possible (nor desirable, BTW) to completely replace MSBuild in Visual Studio.
Visual Studio not just executes MSBuild.exe and parses it's output. The integration is very tight and a lot of GUI aspects rely directly on the content of the MSBuild file.
For example, when you change some project properties in the Visual Studio UI, the changes are (eventually) written to the MSBuild file of the project.
Also, there are some performance improvements, for example Visual Studio "replaces", so to say, the call of csc.exe (the C# compiler) from an MSBuild file by using an in-process compiler, which safes some compile time, because less external processes need to be launched (also described in the above mentioned document)
While all this, from a architectural point of view, is quit likely wrapped and encapsulated by some "interfaces" inside Visual Studio, I haven't yet found a way to have those "interfaces" implement something else that, for example, uses NAnt behind.
Anyway, I think even if technically possible, it would not be technically feasible.
For rake, check out Rake Runner extension. You can run the rake tasks from the solution explorer and check the errors and other output in the Output pane. I have little experience developing vs packages so if anyone want to help, the project is open sourced here.
Motivation:
I have fxcop integrated in the build process, which makes fxcopcmd.exe run each time the target has changed or as long as there are warnings from the previous run of fxcop.
But when one works in the studio, devenv.exe often decides to compile the project in background for whatever reasons. For example, when I add a new project to the solution I notice that fxcopcmd.exe runs, meaning a background build has started. There are also other times as well.
So, I wish to suppress fxcop when built with devenv. Our CI server builds using msbuild, so no problem there.
BTW, if there is a way to disable the background builds, that could be great.
There is a property BuildingInsideVisualStudio which will tell you this.
For example compare the result when using msbuild.exe and devenv.exe with a .csproj with the following AfterBuild target defined
<Target Name="AfterBuild">
<Message Text="BuildingInsideVisualStudio: $(BuildingInsideVisualStudio)" Importance="high"/>
</Target>
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
The only thing I can think of is to either
create a different build type (such as debug_and_rules, release_and_rules, etc). I think ms build could read this.
have your CI server call the fxcop exe separate from building the project. This is what I used to do before fxcop was integrated into VS.
have msbuild set a setting or compiler flag that ms build could read. I'm not sure if this would work.
The background compiler was added in VS 2008 to C#, and as far as I know, is not configurable. VS 2010 is supposed to be ultra configurable so maybe that will change
Edit: formatted my list a little better
I am attempting to compile my Silverlight control project with Nant without luck. Since my project contains XAML files, I am not sure if Nant is capable of generating the .g.cs files from the XAML file to be compiled into the project. I have come across posts where people suggest using the MsBuild task. Is there a way to avoid using the MsBuild task and compile the project using just Nant? I am not against using the MsBuild task. But would prefer to not use it if possible.
Thank You,
Vish
From what I understand nant currently does not support this out of the box. Most people are having to shell to msbuild for those portions of the compile step.
However if you know the extra commands for the precompiler, as in what program is used to gen the g.cs files then you could in theory extend nant with a new task to perform that step and then you could get what you need.
May be more work but if you get it to work post it to the community I'm sure they could use it too, if somebody has not done anything for it yet.
I have taken over the development of a web application that is targeted at the .net 1.0 framework and is written in C# and Visual Basic.
I decided that the first thing we need to do is refine the build process, I wrote build files for the C# projects, but am having tons of problems creating a build file for Visual Basic.
Admittedly, I do not personally know VB, but it seems like I have to hardcode all the imports and references in my build file to get anything to work...certainly not the best way to be doing things...
For any example: if I do not include the namespace System in the build file I will get several errors of common Unkown Types e.g: Guid
does NAnt typically require this for VB code or is does the VB code need a possible NAnt-freindly refactoring?
Does anybody have VB NAnt tips?
I have had a similar experience with NAnt and the vbc compiler for VB.NET projects that are developed with Visual Studio. My solution has been to avoid importing namespaces at the project level in Visual Studio (which occurs by default), and use explicit Imports statements at the class/file level. C# projects work this way by default (no project level namespace imports), and I like the extra information provided by explicit namespace directives when looking at a file.
Interesting that VB.NET and C# VS projects are so different in that respect.
I'm not sure, if you talk about VB or VB.Net.
Either way, have a look at Nant Contrib. Maybe they have a solution.
Are you calling msbuild to build? Or are you calling the VS.NET IDE exe to build. We've had no problems with our c#/VB.NET mix using CC.NET and NAnt and do not have to specify referenced assemblies inside of the build files.
What we do is using the IDE exe to build solutions that contain the projects we want to build.
I would recommend that you take the language specific compilers out of the equation for this one. And you can still use NAnt to do this:
First start off with a target that uses MSBuild because that will compile your project regardless of language used and take care of the dependencies for you. That means you don't need to hard code them in.
Example:
<target name="WinBuild">
<exec program="msbuild.exe"
basedir="${DotNetPath}"
workingdir="${SolutionPath}"
commandline="MySolution.sln
/nologo /verbosity:normal /noconsolelogger
/p:Configuration=Debug /target:Rebuild" />
</target>
I think once you've got that nailed - you can spend plenty of time trying to get NAnt to compile natively, but in my opinion, this is what I would use for this project since it seems to be a once off?
Hope that helps,
Cheers,
Rob G