Create Visual Studio Solution From msbuild .proj file - visual-studio-2010

Does anyone know if is possible to have a Visual Studio project created automatically from a msbuild .proj file?
Thanks

I've just been trying to do something similar. Basically VS2010 won't let me add a "*.proj" file to a solution. HOWEVER, I found that if I simply renamed it to be a vbproj or a csproj, then VS2010 would let me add it to a solution, and it seemed to invoke it correctly. (The vbproj seemed 'nicest' to me, in that it didn't have a redundant "References" sub-folder.)
It does seem odd that VS2010 seems unable to work with an ad hoc MSBuild project file, demanding instead one that is tied explicitly to a specific languade (C#, VB.Net, SQL, WiX, ...)
In my case, it simlpy had an Exec task in it to go and invoke Doxygen to build developer documentation. That is, it was pretty simple! I hope the same trick might work for you too!
Another option might be for you would be too look at the "Makefile" project type in VS2010 (its under C++); that would allow you to directly invoke nmake and do away with the proj wrapper completely.

Related

What type of extension for VS (and how) to make, to generate C# or C++ code from some text [more so a model]?

I am new to Visual Studio Extensibility and want to make an addin/extension which shall do the following:
It should read all the files with a specific file extension (assume "*.ump").
It should process the text/code/whatever in the files.
It should create new Class/Code file with some code in it. [The code will be produced in step 2, just need to know how to do it?]
Yet, I have been racking my brains through extensibility, saw the single file generators .... and addins which go through ProjectItems and can detect the file extension,
BUT I HAVE NOT BEEN ABLE TO FIND a complete tutorial, guide or explanation as to how or what to do!!
Please help...
You don't want to read all files with a specific file extension in Visual C++ project nor standard Visual C# project. You may do that with hand-made MSBuild project (included in the solution).
In Visual C++ projects, there is a way to define custom tools. They are run as separate processes, so you can implement them in anything you want. Studio will ask you whether you want to define a tool (they are defined in special xml files; studio has dialog for editing them) when you add a file with extension unknown to it. In Visual C# projects, just manually write a MSBuild tasks and insert them into the project.
Do whatever you want. IIRC the generated files will have to be included in the project though. Well, for MSBuild, just tweak the project to your heart's desire, but in Visual C++ they have to.
You can combine MSBuild (csproj,vbproj) and VisualC++ projects in a single solution, so I recommend using separate.
If you ever find out you need to compile for different target where you can't use Visual Studio, you'll be glad that you have stand-alone tool you were just calling from Studio and not something that embeds in it.

Setup MS Visual Studio for the PAWN language

I am used to work with MSVS 2008 and 2010 for some time now. I did some projects using C# and C++ but I am still a rookie.
For my next project I have to develop using the PAWN language and would like to use MSVS as my IDE. I did some research on the subject but since PAWN is not that popular I didn't find any satisfying solution.
My question is if there is a way to configure MSVS to use as IDE for my PAWN project and if how to do it. Probably something like http://www.ironpython.net (?) - but I really don't have a clue.
The general solution for this is to use the Makefile Project template. You can specify the commands that build, clean and rebuild commands. You typically only need the build command. It is up to you to write it, anything goes. You can add source code files to the project but there is no way to reference them in the build command. In other words, if you add a new source code file then you'll have to modify the build command by hand.

FSLex example solution?

I've been using C/lex for a long time and would like to use F#/fslex now.
I'm comparably well off in C# and in the process of learning F#.
The only thing is that I can't see any project example or template where fslex is properly included in the Visual Studio build process.
Does anyone know where I can find one?
Lots of Greetings!
Volker
Unfortunately, there is no built-in item template for .fsl files, because FsLex is a part of PowerPack (so Visual Studio cannot expect that it will be installed). It would be definitely useful to have some template that could be installed with PowerPack!
Anyway, if you're looking for a sample project that uses FsLex (and has .fsl files as part of the project), then you can take a look at the F# source code (distribtued with the Visual Studio 2008 MSI/ZIP package). The project that contains .fsl is FSharp.Compiler.fsproj and on my installation, it can be found in C:\Programs Files\FSharp-1.9.9.9\source\fsharp\FSharp.Compiler. Surprisingly, it includes a lexer for the F# language itself :-).
To add FsLex item to the MSBUILD project (which is also Visual Studio project), it uses the following:
<FsLex Include="..\lex.fsl">
<OtherFlags>--lexlib Internal.Utilities.Text.Lexing</OtherFlags>
<Link>lex.fsl</Link>
</FsLex>
<Compile Include="lex.fs" />
In case you also needed FsYacc, here is an example (also from FSharp.Compiler.fsproj):
<FsYacc Include="..\pars.fsy">
<Module>Microsoft.FSharp.Compiler.Parser</Module>
<Open>Microsoft.FSharp.Compiler</Open>
<OtherFlags>--internal --lexlib Internal.Utilities.Text.Lexing
--parslib Internal.Utilities.Text.Parsing</OtherFlags>
<Link>pars.fsy</Link>
</FsYacc>
<Compile Include="pars.fs" />
Note that you need the FsYacc/FsLex command to invoke the custom tool, but also the Compile command which tells the compiler to include the produced fs file when building the project.
I'm using the free VS Shell until I finally threaten myself enough to finally buy the full VS, and unless I'm doing something wrong, (and I probably am) none of the normal solutions seem to work for me. What I do is add the following pre-build events to the project properties:
"C:\Program Files (x86)\FSharpPowerPack-2.0.0.0\bin\fslex.exe" "$(ProjectDir)\Lexer.fsl"
"C:\Program Files (x86)\FSharpPowerPack-2.0.0.0\bin\fsyacc.exe" "$(ProjectDir)\Parser.fsy" --module Parser
That seems to work well enough for me. Errors all go to the output window. If you're on a 32-bit machine, you would remove the (x86) from those paths.
Doing a little research it looks like they need to be separate. I found the following at this blog post ( http://blogs.msdn.com/chrsmith/archive/2008/01/18/fslex-Sample.aspx ) by Chris Smith:
Although you can add an F# Lex Specification file from the Visual Studio Add-In, to run fslex you will need to break to the command line. Fslex.exe is located in your F# distribution’s ‘bin’ directory.
Hope that helps.

Creating a custom project type for Visual Studio to build Borland C++ Builder projects into Visual Studio

I want to start the develop of a custom project type for Visual Studio that builds a BPR project with Visual Studio.
I need some hints to beginning with this project. Where can I find a template for this type of projects?
My target is to remove the Borland C++Builder's ugly and unstable interface from the development process and work enterely from Visual Studio.
Edit: Oops, I didn't really see that you're about to create a new project type for C++ Builder files. In that case, you have to build a language package. The Visual Studio Extensibility site should get you started. Also have a look at this more specific link.
I'll leave my old answer here for reference, because it might help people who just want to build C++Builder projects without creating a whole new project type :)
You didn't specify the version of Visual Studio, but I'll assume a recent one. In Visual Studio 8 and 9, most project files (all popular ones except Visual C++) are actually MSBuild files and can therefore be built by MSBuild. You can add a simple command line task (Exec) to build your bpr on the command line, or you can create a custom task for this (if you don't find one already available - the search terms should be MSBuild and custom task). This way, both Visual Studio and MSBuild can build anything you like. If you don't have an MSBuild file to start with or want to dive into developing a task, the MSBuild project template for Visual Studio will help you.
Oh, and other than that, if you don't actually need C++Builder things, you might as well export the BPR as a solution (or create a new solution and add the files).
Integrating C++Builder projects into a build process should be a lot easier with C++Builder 2007 or 2009 as both use MSBuild as build system. But then, I think that upgrading to a recent version of C++Builder solves your problem the other way :)

Compiling a .vbproj or .csproj project file without Visual Studio

Is there a way to compile a .vbproj or .csproj project file directly, just like Visual Studio does?
When you compile in Visual Studio, the "output" window shows the actual call to the compiler, which normally looks like:
vbc.exe [bunch of options] [looooong list of .vb files]
I would like to programatically call "something" that would take the .vbproj file and do whatever Visual Studio does to generate this long command line. I know i could parse the .vbproj myself and generate that command line, but I'd rather save myself all the reverse engineering and trial-and-error...
Is there a tool to do this? I'd rather be able to do it in a machine without having Visual Studio installed. However, if there's a way to call Visual Studio with some parameters to do it, then that'll be fine too.
I looked briefly at MSBuild, and it looks like it works from a .proj project file that i'd have to make especially, and that I'd need to update every time I add a file to the .vbproj file. (I did look briefly at it, so it's very likely I missed something important)
Any help will be greatly appreciated
MSBuild is the easiest way to go. For instance:
msbuild /property:Configuration=Release MyFile.vbproj
MSBuild can also take your solution file and use it to do the compile.
You can use either MSBUILD or CSC. MSBuild, which as you mentioned, does use your project and solution files. CSC will compile specific files, or all files in a specific directory tree.
You should also look at automating your builds with NAnt and/or CruiseControl.net.
Also, here is an example on how to compile your code without visual studio using CSC.
http://blog.slickedit.com/?p=163
Just so you know .vbproj and .csproj files are MSBuild. So everything that you've read, you can apply to those files directly.
Sayed Ibrahim Hashimi
My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build
In project solution folder:
msbuild wpfapp1.sln /p:BuildProjectReferences=true
MSbuild is usually located in:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
(or something similar, depending on the version)
csc.exe compiles files, msbuild compiles projects and solutions
At the top of a .vbproj file is a . Add this line to the property group to suppress the VB runtime:
<NoVBRuntimeReference>On</NoVBRuntimeReference>
MSBuild does the rest. No need to use the command line if you have the IDE.

Resources