Tool for creating Visual Studio solution file(sln) from MSBuild.SolutionSdk.
This project aims to prevent conflicts with sln files by add *.sln
to .gitignore
.
This project is still WIP, so spec may be changed.
- msbuild after 15.3
- dotnet-sdk 2.1.300 or later
- Visual Studio 2017 or later
- creating any project
dotnet new [projecttype]
or by Visual Studio - creating MSBuild.SolutionSdk project file like following(called
slnproj
)<Project Sdk="MSBuild.SolutionSdk/0.1.0> </Project>
- creating MSBuild.SolutionSdk.SlnGen project file like following(called
slngenproj
)<Project Sdk="MSBuild.SolutionSdk.SlnGen/0.1.0"/>
- execute generating sln target by following command
- by dotnet-sdk, execute
dotnet msbuild [path/to/slngenproj]
- by Visual Studio, execute
msbuild [path/to/slngenproj]
from Visual Studio's developer command prompt - warning: if
sln
file have been already existing, it will be overwritten.
- by dotnet-sdk, execute
Then you can see sln files in next to slnproj
files.
if you want to map configuration and platform to different name(solution platform setting="AnyCPU", but individual project platform setting="Win32"),
you can do this by editing slnproj
file like following.
note: wild card is allowed in project path.
<Project>
<ItemGroup>
<Project Update="path/to/your/proj" Condition="'$(Configuration)' == 'Debug'">
<Configuration>Abc</Configuration>
</Project>
</ItemGroup>
</Project>
<Project>
<ItemGroup>
<Project Update="path/to/your/proj" Condition="'$(Platform)' == 'AnyCPU'">
<Platform>Win32</Platform>
</Project>
</ItemGroup>
</Project>
If slnproj includes projects which is not recognized by dotnet sdk(like vcxproj), you must execute via Visual Studio's developer command prompt.
followings can be added to ItemGroup
in slngenproj
.
This affects what slnproj
file will be processed.
defaults are:
**/*.slnproj
- It means all
*.slnproj
underslngenproj
is processed.
- It means all
This affects what Configuration
property is specified when processing slnproj
.
defaults are:
- Debug
- Release
This affects what Platform
property is specified when processing slnproj
.
defaults are:
- AnyCPU
followings can be added to PropertyGroup
in slngenproj
If true
(ignore case) is set, default SlnProj
inclusion is enabled, if false
, disabled.
default is true
.
following items in slnproj are affected to slngen behavior
If added, slngen processing for generating sln. This can be added the following metadata:
- Configuration
- Platform
- SolutionFolder
- logical solution folder path separated by
/
or\
- logical solution folder path separated by
- DependsOn
- project dependency(projects must be built before project build.)
If added, solution item is added to generated sln. This can be added the following metadata.
- SolutionFolder
- logical solution folder path separated by
/
or\
- if not set, all items are located in "Solution Items"
- logical solution folder path separated by
This project is inspired by MSBuild.SolutionSdk and SlnGen. Thanks a lot for great work.