Visual Studio to Make - visual-studio

While I love the Unix toolset family(including its black sheep Make) the project I'm working on currently is cross platform. That means having a Visual studio project ready for build.
So my question is, is there a tool/plugin for importing a Make file into VS or conversely is there a way to export a visual studio project into Make? Or any textual form, actually. I could write a script that parsed that into a Make file.

I would suggest making using Cmake... which will generate a set of makefiles or a visual Studio Project.

Related

Source file list from a Visual Studio project

Is there any way of passing the list of source files, that Visual Studio would build, to a makefile. Ideally Visual Studio would set an environment variable with a list of the files to compile. But unfortunately I have not discovered such a variable. I know I could write a script to parse the project file but I would really like to find a method which does not rely on a script. I would like to be able to set up the Visual Studio project so that different source files are built depending on the build configuration, using the Exclude from Build option. I would then like the makefile to only build the files that were not excluded. I am attempting to use Visual Studio as the development environment for a project which runs on different hardware and OS combinations.
P.S. Using Visual Studio is non-optional, and not my personal choice.
Create a MakeFile project within the VS solution.
This should be found under File -> New -> Project -> Visual C++ -> Other -> Makefile Project
Using Visual Studio 2017, there is a MakeFile template that can be used.
Additional instructions on how to do so can be found here

Use cmake to generate Visual Studio sln project without link to original CMakeFiles.txt

I need to use cmake to generate visual studio sln file, BUT I want to ensure, that this generated *.sln file will not be connected with original CMakeFiles.txt (I want to generate sln file once).
I know that this is not typical usage and the connection with source CMakeFiles.txt is in standard usage perfect, but in my case it is not wanted -- I want to distribute these sln files (solution with projects) to some colleagues, who do not have CMake.
Maybe there is another approach (except cmake), to create few visual studio project without annoying clicking in Visual Studio.
Thanks,
Radek
I need to use cmake to generate visual studio sln file, BUT I want to
ensure, that this generated *.sln file will not be connected with
original CMakeFiles.txt
By design CMake will generate solution files that depend on CMake so this part is not really possible with CMake alone.
Maybe there is another approach (except cmake), to create few visual
studio project without annoying clicking in Visual Studio.
There is a way to stop regeneration in the IDE. I use this in many of my projects most likely for the same reason you do. At least with older versions of Visual Studio the regeneration caused dozens of prompts. Although I believe Visual Studio 2013 only prompts 1 time now I still enable this. The following code (inserted near the top of my root CMakelists.txt) is what I use to enable the option to suppress IDE regeneration.
option (CMAKE_SUPPRESS_REGENERATION "Suppress the cmake macro that causes regeneration of build scripts during build" ON)

Visual studio 2010 rebuilds with no modifications?

I found something strange when i was building a project, after I built my project, I can get the latest output file (.exe) and then I tried building the project again.
As far as I know, at this time visual studio won't make a new output file again, but it made a newer file again even though I didn't modify any source codes.
Why is this happening?
as i know, at this time visual studio must not make a new output file again.
Visual Studio rebuilds the file even if there are no code changes.
Visual Studio does not recompile if there no changes, but always generates (build) a new executable.

Is there a tool to automatically convert a make file to sln/vcproj?

Google reveals many tools for taking Visual Studio format sln/vcproj files, and producing a make file from them. But I can't find one that solves the opposite problem - I have a make file that references hundreds of .c and .h files and (for convenience, for debugging, for writing code in the VS IDE) would like to open it as a Visual Studio project.
Where can I find a tool to take an arbitrary make file as input, and produce Visual Studio project/solution files as output?
Makefile Project Wizard
You might be able to find a converter for a well-constrained set of makefiles, but a converter for any arbitrary makefile would be tricky. They are mini-programs, after all, that would have to be evaluated. And not all makefile concepts map directly to Visual Studio projects.
If you only have one project to worry about, I'd just manually put together a project in Visual Studio (tip: you can select more than one file in the "Add existing file..." dialog). If you do this regularly, perhaps look into a tool like Premake or CMake to help automate the generation of the projects (and if necessary, a new Makefile) for you.

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