Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Visual Studio Solution and Project locations

Matthew_Nicoll
Beginner
847 Views

I have programmed fortran from the command line for many years.
I have just recompiled many CVF programs in IVF 16 (at the command line).
With some trepidation I opened Visual Studio Community 2015. 

After some reading about Solutions and Projects, I gather that:
  - the source code which creates a single executable resides in a Project.
  - a Project resides in a Solution
  - a Solution may contain many Projects.

So I figured I should first create a Solution.
But there is no "New Solution" option of the File menu.
When I select New Project, select Intel Visual Fortran / Console Application
It automatically creates a new Solution to put the Project in, but there 
is no opportunity to specify the folder location or name of the Solution!
(Contrary to what is implied in step 5 under "Creating a New Project"
on page 76 of the Intel Fortran User Guide)

So I googled how to create an empty solution, and got:
  To create an empty solution
  1.On the File menu, click New and then click New Project.
  2.In the left pane, select Installed, select Other Project Types, and then select Visual Studio Solutions from the expanded list.
  3.In the middle pane, select Blank Solution.
  4.Set the Name and Location values for your solution, then click OK.

That seems a bit roundabout, but it worked.
But then when I selected File/New Project, I got no opportunity to put
my new project in the Solution I had created!

And why is there no "Open Solution" option on the File menu??
(Other than in "Recent Projects and Solutions").

I must be thinking incorrectly!

Questions:

1. Should I forget about Solutions and just let Visual Studio create
   a new Solution for every Project (assuming all-Fortran source code)?  
      
2. If so, how do I tell Visual Studio where to store a solution+project
   when I create a new Project?  

0 Kudos
10 Replies
Steven_L_Intel1
Employee
847 Views

You would want a new Solution for each separate executable application. The solution would have one or more projects. Usually just one but if you had distinct libraries or DLLs you were building, you might want more than one. (Also for mixed-language, but you already know that.)

The typical flow is to create a new project of the appropriate type using the New Project wizard. This will automatically create a Solution file. The default behavior is to add the Solution to the folder listed in Location, and then to create a subfolder for the project under that. My preference is to have the project and solution in the same folder (unless I know it's going to be a multi-project solution), so I uncheck the box "Create directory for solution".

Once you have a solution you can add existing or new projects by right clicking on the Solution in Solution Explorer and choosing appropriately. If you wish to create the solution separately, you already found the way. It's an unusual path so it's not so obvious.

Why is there no File > Open Solution? It is "Open Project/Solution" - the first entry.

Does this help?

0 Kudos
Matthew_Nicoll
Beginner
847 Views

Is the "New Project Wizard" what I get when I select "New Project" from the File menu?

(I can't find anything else called "New Project Wizard" !)

I have attached the New Project window I get.  

Where is "Location"?

Where is the "Create directory for solution" checkbox?

 

0 Kudos
Steven_L_Intel1
Employee
847 Views

Strange - I don't know why you can't see the options. See my screenshot attached. And yes, I meant what you get with New Project.

I do see something odd in your screenshot, though. It shows Visual Basic as an available template but not Visual C++. I don't know how that combination is possible and still have a functional Intel Fortran.

0 Kudos
Matthew_Nicoll
Beginner
847 Views

I have attached the Visual Studio "About" window.

Have I got the correct version?

Intel Fortran is working within Visual Studio, because I was able to compile and link a "Hello World" Fortran program.

0 Kudos
Steven_L_Intel1
Employee
847 Views

That should be fine. I'm puzzled as to why C++ (and the other languages) don't show, though maybe they're under Other Languages.

0 Kudos
Matthew_Nicoll
Beginner
847 Views

Yes, Visual C++ is under "Other Languages" in the New Project window.

It is the "Location" field and "Create Directory for Solution" checkbox that you referred to that I would like to find!

0 Kudos
Steven_L_Intel1
Employee
847 Views

I have been unable to find any reference indicating why those are not visible to you. I don't have VS Community here but I will try this at home where I do have that. I'm pretty sure I get that option with Community, though.

What does the Tools > Options > Projects and Solutions > General page look like for you?

0 Kudos
Matthew_Nicoll
Beginner
847 Views

See attached.

I could set the "Projects location" here I guess.

0 Kudos
Steven_L_Intel1
Employee
847 Views

If you have a place you want your solutions/projects collected you can change the option there - I use C:\Projects for example.

You have a bunch of those options unchecked where I have all but "Track active item" checked. See if checking the other boxes (then clicking OK and restarting VS) makes a difference.

0 Kudos
Matthew_Nicoll
Beginner
847 Views

Aha!  After checking those boxes, I now see Name, Location, Solution and Solution name fields at the bottom of the New Project window!

Thanks Steve.

0 Kudos
Reply