MSBuild Extension Pack simple tutorial - msbuild

I am looking for a very simple example that shows what exactly is and how to use the MSBuild Extension Pack: http://msbuildextensionpack.codeplex.com/ I just cannot find anything for a real beginner. Thank you.

Go through these Links,
They would be very useful, I figured out how to use MSBuildCommunityTasks through them,
How do I import the msbuildcommunitytasks project from another msbuild project with a relative file path?
Msbuild and SVN update
Also,
Example
<SvnUpdate
Username="$(CommitUser)"
Password="$(CommitPassword)"
LocalPath="$(ProjectDir)">
</SvnUpdate>
Its just what you use on the Command Line.

Related

How can I disable TrackFileAccess via CMake?

My company uses CMake to manage their code. Some of my colleagues are on Linux, and I'm on Windows, using Visual Studio. Our code is organised into a number of libraries, which translates into a number of Visual Studio projects under one solution.
To speed up compilation, I'm trying to integrate clcache with my setup. To do this, I need to disable TrackFileAccess for every project in the solution as noted here.
So, to my understanding, I have to modify the CMake files to either either inject some XML into each library's .vcproj file, or to modify the parameters passed to msbuild.exe itself. I'm having a lot of trouble figuring out how to do either of these things.
To try invoking msbuild.exe with specific command line parameters, I found the variable CMAKE_MAKE_PROGRAM. I tried using it with SET(CMAKE_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM} /p:TrackFileAccess=false" CACHE INTERNAL ""), but I can see from Process Explorer that msbuild.exe was not getting invoked with that argument.
I couldn't work out how I'd go about injecting XML into the .vcproj files, or if it can even be done with CMake. Is there actually a way to do it? Or would I instead need to perhaps write a script to run after CMake runs, to edit its output?
While we're at it, do I really need to edit every single .vcproj file, or could I perhaps edit something that each .vcproj will inherit?
Aha!
I did more digging, and I think I'm barking up the wrong tree with CMake. It turns out, I could edit C:\Users\me\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props and add in
<PropertyGroup Label="Globals">
<TrackFileAccess>false</TrackFileAccess>
</PropertyGroup>
and it works!

Run SingleFile Generator through MSBUILD

i have created a Custom tool (SingleFile generator) using IVsSingleFileGenerator. Which takes "xyz.Resx" file as input and generate "xyz.Designer.resx.cs" file. This file can be generated on building/Saving the Application through IDE.
Issue is, I have given the Custom Tool Property for any .Resx file and build the application through MSBUILD. Now I am unable to build/
generate the "Designer.resx.cs" file.
How to prepare a Custom Task to run this custom tool through MSBUILD.
plz help in doing the same.
Thanks in advance.
I don't have much knowledge about this custom tool IVsSingleFileGenerator which you are using. To execute it in MSBuild you may need targets for the same given by them to generate the resx.cs file from .resx file. Or you may add a commandline call of this tool in your MSBuild script and try it.
I don't think you can run CustomTool from MsBuild. Since you're the one that wrote the tool, I would definitely suggest to create msbuild task and start using it.
Here are some ideas how to do that:
http://msdn.microsoft.com/en-us/library/t9883dzc.aspx
http://blogs.msdn.com/b/msbuild/archive/2006/01/21/515834.aspx
Another approach would be to write executable, but that will be less efficient.
Here is how you call executable from msbuild
<Target Name="your-target-name" AfterTargets="the-starting-point-of-your-target">
<Exec Command="your_exutable-here parameters_here" WorkingDirectory="your_working_folder" />
</Target>
Third approach would be to write inline msbuild task
http://blogs.clariusconsulting.net/kzu/writing-inline-msbuild-tasks-in-c-for-one-liners/
I hope that helps

platform independent .proj file

I want to use my .proj file for both msbuild and xbuild.
Currently I have paths like
$(ProjectDir)\..\..\
How can I re-write these paths so I can call xbuild on the proj file
without having to modify?
xbuild is smart enough to handle the directory separators for you, so please stick to MSBuild style. You just need to pay attention to others.
Grab a Linux box and try it out.

How to use nAnt to get latest of all files in a Visual Studio Solution?

Is there a task or something that can accept an sln file and then get latest of each file in the sln?
Sourcegear provides custom NAnt taks to work with their repository. I don't know if they work based off the solution file, but you might want to give them a try and see if they'll help you.

msbuild: when in the build project is Microsoft.VisualBasic.Targets 'imported' by msbuild?

Here's my situation: I'm trying to understand how msbuild works by looking at the build files located in the .NET framework install path:
C:\Windows\Microsoft.NET\Framework\v3.5>dir /s/b microsoft*
Microsoft.Build.Tasks.v3.5.xml
Microsoft.Build.xsd
Microsoft.Common.targets
Microsoft.Common.Tasks
Microsoft.CSharp.targets
Microsoft.Data.Entity.targets
Microsoft.VisualBasic.targets
Microsoft.WinFx.targets
MSBuild\Microsoft.Build.Commontypes.xsd
MSBuild\Microsoft.Build.Core.xsd
I'm assuming that msbuild starts with Microsoft.Common.Targets, and then at some point in the future msbuild 'looks' at my vb project file extension (.vbproj) and loads 'Microsoft.VisualBasic.targets'.
two questions:
1) Is my interpetation correct?
2) can you explain to me, where is the code that determines that this is a .vbproj file, and loads 'Microsoft.VisualBasic.targets' accordingly? Is the code locked away in an assembly somewhere, or is it visible in the build files listed above?
It "starts" with your .vbproj file. Take a look at that file, it will <Import> the Microsoft.VisualBasic.targets, which in turn will <Import> Microsoft.Common.targets.
In 4.0, which is currently available in Beta, there is a /preprocess switch which will make this all clear.