The Visual Studio Plugin generate files that are used by the Visual Studio IDE, thus making it possible to open the solution into Visual Studio (File
- Open
- Project/Solution…
).
What exactly the visual-studio
plugin generates depends on which other plugins are used:
Plugin | Description |
---|---|
None |
Generates minimal solution file. |
Adds a project representing the C++ application to the solution file. |
|
Adds a project for each specified linkage representing the shared and/or static library to the solution file. |
Usage
plugins {
`visual-studio`
}
plugins {
id 'visual-studio'
}
The Visual Studio Plugin adds a number of tasks to your project.
The main tasks that you will use are the visualStudio
, cleanVisualStudio
and openVisualStudio
tasks.
Tasks
The following diagram shows the relationships between tasks added by this plugin.
Lifecycle Tasks
visualStudio
— Task-
Depends on:
projectNameVisualStudioSolution
and all Visual Studio project file generation tasksGenerates all Visual Studio configuration files.
cleanVisualStudio
— Delete-
Depends on: all Visual Studio project and solution file clean tasks
Removes all Visual Studio configuration files.
openVisualStudio
- Task-
Depends on:
visualStudio
Open the Visual Studio solution inside the IDE.
IDE Workspace Tasks
projectNameVisualStudioSolution
- GenerateSolutionFileTask-
Generates the
.sln
file. This task is only available on the root project.
IDE Project Tasks
C++ Application Plugin Tasks
projectNameVisualStudioProject
— GenerateProjectFileTask-
Generates the
.vcxproj
file for the application component. projectNameVisualStudioFilters
— GenerateFiltersFileTask-
Generates the
.vcxproj.filters
file for the application component. mainVisualStudio
- Task (lifecycle)-
Depends on:
projectNameVisualStudioProject
andprojectNameVisualStudioFilters
Generates all Visual Studio project files for the application component.
C++ Library Plugin Tasks
projectNameDllVisualStudioProject
— GenerateProjectFileTask-
Generates the
.vcxproj
file for the shared linkage of themain
component. projectNameDllVisualStudioFilters
— GenerateFiltersFileTask-
Generates the
.vcxproj.filters
file for the shared linkage of themain
component. projectNameLibVisualStudioProject
— GenerateProjectFileTask-
Generates the
.vcxproj
file for the static linkage of themain
component. projectNameLibVisualStudioFilters
— GenerateFiltersFileTask-
Generates the
.vcxproj.filters
file for the static linkage of themain
component. mainVisualStudio
- Task (lifecycle)-
Depends on:
projectNameDllVisualStudioProject
(for shared linkage),projectNameDllVisualStudioFilters
(for shared linkage),projectNameLibVisualStudioProject
(for static linkage) andprojectNameLibVisualStudioFilters
(for static linkage)Generates all Visual Studio project files for the library component.
Configuration
The Visual Studio Plugin allows for some customization of the generated files. The following sections are shows the customization.
Change solution generated file location
The location of the generated solution can be configured on the root project:
visualStudio {
solution {
solutionFile.setLocation(file("solution.sln"))
}
}
visualStudio {
solution {
solutionFile.location = file('solution.sln')
}
}
Change project generated files location
The location of the generated project files can be configured on any project:
visualStudio {
projects.all {
projectFile.setLocation(file("project.vcxproj"))
filtersFile.setLocation(file("project.vcxproj.filters"))
}
}
visualStudio {
projects.all {
projectFile.location = file('project.vcxproj')
filtersFile.location = file('project.vcxproj.filters')
}
}