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.
Related
before I explain my current problem with Visual Studio in combination with CMake, I try to explain what I want to accomplish as there might be a better solution.
At our company we have a huge code base mainly written in C for QNX. For development we are using the standard IDE QNX momentics. As this is based on a quite old eclipse version ... the whole IDE sucks.
I'm currently evaluating to use Visual Studio as a replacement. With a really simple HelloWorld-programm I was able to build and debug the project from within VS using CMake and a CMakeSettings.json.
As our code base is basically organized in a tree-like structure, I've created a typical hierarchy of CMakeLists.txt which allows me to build single/multiple projects.
As QNX delivers its own compiler I've created a toolchain file, this is running fine so far, the required toolchain is invoked once a build is triggered via cmake.
Now for the part that I'm struggling with:
How to use this CMake setup in order to develop/debug code from VS?
I had two ideas in mind which don't really work or I'm doing something wrong.
Use the CMake generator for VS 2019 and generate a complete solution. Problem: The toolchain file is not "used" as all projects will be setup with the internal VS compilers. Is there any way to get this working? I thought calling cmake -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=$FILE would do the job. Additionally: how would I incorporate the debugger configuration? With this solution the CMakeSettings.json seems to be ignored as VS solutions are used.
Use File->Open->CMake to open the root project. Shouldn't this show all "contained" projects which also include a CMakeLists.txt as projects? I can only see the folder tree in the Solution Explorer. Build a single project from the solution explorer is also not possible ... there is simply no option.
Anyone with experience on this topic?
Minor comment please limit questions to 1 question in the future. Multiple questions clutters questions and makes search results worse.
============================================================
I'll answer question #1 this part of question number 1.
"Use the CMake generator for VS 2019 and generate a complete solution. Problem: The toolchain file is not "used" as all projects will be setup with the internal VS compilers. Is there any way to get this working? I thought calling cmake -G "Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE=$FILE would do the job."
Instead of using Visual Studio as your generator try using "Ninja" instead. Ninja will work if your toolchain code is correct. Toolchains and visual studio are complicated to say the least. If you wanna go down that rabbit hole I can help but that's a separate question
Basically try switching to Ninja instead of Visual Studio as your generator for CMakeSettings.json. Ninja is very easy to write toolchains for.
======================================================================
"Additionally: how would I incorporate the debugger configuration?"
The MSDN articles are actually quite good. I figured it out this week. In my opinion the debugger configurations are more powerful with the CMake approach than vanilla visual studio.
Configure CMake debugging sessions
https://learn.microsoft.com/en-us/cpp/build/configure-cmake-debugging-sessions?view=msvc-160
"Tutorial: Debug a CMake project on a remote Windows machine"
https://learn.microsoft.com/en-us/cpp/build/cmake-remote-debugging?view=msvc-160
Trust me once it clicks you'll love it.
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.
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.
In short: is there a way to compile and run single file in NetBeans or Visual Studio without having to setup and tinker with projects?
I'm currently using code::blocks as my IDE. It's fast and very simple: perfect for my needs as a begginner.
I wanted to dive a little deeper and try out a more advanced IDE such as NetBeans or Visual Studio. It appears I have to mess with projects and have a setup that seems overkill for having to compile and run one very simple .c/.cpp source file that contains less than 50-100 lines of code etc.
Is there a way around this?
You always have to setup a project - this is where information about libraries etc is found by the IDE, so it cannot do without. If you just have one file, and not a lot of dependencies you could just stick with a plain editor. Once you want auto completion of functions, refactoring, etc... you have to store the information about what is relevant somewhere, and the some sort of 'project' will become necessary.
Anyone know of a way to create Visual Studio Projects from a build based on Jamfiles?
I'd settle for a jamfile -> XML-or-some-other-intermediate-format exporter tool, so I could write my own.
This jam distribution has a tool that does that:
http://redmine.jamplex.org/
See here:
http://redmine.jamplex.org/git/jamplus/docs/html/jamtoworkspace.html
Haven't used any of it myself yet, so I'm afraid I can't say anything about how well it works.
You might also consider CMake. CMake files are about as easy to write as Jamfiles, and CMake can generate projects for Visual Studio, Xcode, and Unix Makefiles automatically. I used to use Jam for all my Linux projects, but once I discovered CMake, I haven't gone back.
JamPlus has a built-in workspace generator that reads a project's Jamfiles and exports an IDE workspace.
http://jamplus.org/git/jamplus/docs/html/jamtoworkspace.html