Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions Sharpmake.Generators/VisualStudio/Csproj.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static class Project
public static string ProjectEnd =
@"</Project>";


public static string ProjectDescription =
@" <PropertyGroup>
<Configuration Condition="" '$(Configuration)' == '' "">[options.DefaultConfiguration]</Configuration>
@" <Configuration Condition="" '$(Configuration)' == '' "">[options.DefaultConfiguration]</Configuration>
<Platform Condition="" '$(Platform)' == '' "">[defaultPlatform]</Platform>
<PlatformTarget Condition="" '$(Platform)' == '' "">[defaultPlatform]</PlatformTarget>
<ProjectGuid>{[guid]}</ProjectGuid>
Expand Down Expand Up @@ -112,7 +112,6 @@ public static class Project
<UseWindowsForms>[options.UseWindowsForms]</UseWindowsForms>
<Nullable>[options.Nullable]</Nullable>
<PublishAot>[options.PublishAot]</PublishAot>
</PropertyGroup>
";

public const string DefaultProjectConfigurationCondition = "'$(Configuration)|$(Platform)'=='[conf.Name]|[platformName]'";
Expand Down Expand Up @@ -146,6 +145,21 @@ public static class Project
<CopyVsixExtensionFiles>[options.CopyVsixExtensionFiles]</CopyVsixExtensionFiles>
<CopyVsixExtensionLocation>[options.CopyVsixExtensionLocation]</CopyVsixExtensionLocation>
<ProduceReferenceAssembly>[options.ProduceReferenceAssembly]</ProduceReferenceAssembly>
";
public static string ConfigurationsItemBegin =
@"<Configurations>";
public static string ConfigurationsItemEntry =
@"[conf.Name];";
public static string ConfigurationsItemEnd =
@"</Configurations>
";

public static string PlatformsItemBegin =
@"<Platforms>";
public static string PlatformsItemEntry =
@"[platformName];";
public static string PlatformsItemEnd =
@"</Platforms>
";

public static string ImportProjectItemSimple =
Expand Down
26 changes: 26 additions & 0 deletions Sharpmake.Generators/VisualStudio/Csproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,7 @@ List<string> skipFiles

GeneratedAssemblyConfigTemplate generatedAssemblyConfigTemplate = new GeneratedAssemblyConfigTemplate(project.GeneratedAssemblyConfig, isNetCoreProjectSchema, RemoveLineTag);

Write(VsProjCommon.Template.PropertyGroupStart, writer, resolver);
using (resolver.NewScopedParameter("project", project))
using (resolver.NewScopedParameter("guid", projectPropertyGuid))
using (resolver.NewScopedParameter("options", options[_projectConfigurationList[0]]))
Expand All @@ -1339,6 +1340,31 @@ List<string> skipFiles
Write(Template.Project.ProjectDescription, writer, resolver);
}

Write(Template.Project.ConfigurationsItemBegin, writer, resolver);
foreach (Project.Configuration conf in _projectConfigurationList)
{
using (resolver.NewScopedParameter("conf", conf))
{
Write(Template.Project.ConfigurationsItemEntry, writer, resolver);
}
}
Write(Template.Project.ConfigurationsItemEnd, writer, resolver);

Write(Template.Project.PlatformsItemBegin, writer, resolver);
HashSet<string> addedPlatform = new HashSet<string>();
foreach (Project.Configuration conf in _projectConfigurationList)
{
if (addedPlatform.Add(Util.GetPlatformString(conf.Platform, conf.Project, conf.Target)))
{
using (resolver.NewScopedParameter("platformName", Util.GetPlatformString(conf.Platform, conf.Project, conf.Target)))
{
Write(Template.Project.PlatformsItemEntry, writer, resolver);
}
}
}
Write(Template.Project.PlatformsItemEnd, writer, resolver);
Write(VsProjCommon.Template.PropertyGroupEnd, writer, resolver);

if (!string.IsNullOrEmpty(project.ApplicationIcon))
{
using (resolver.NewScopedParameter("iconpath", Util.PathGetRelative(_projectPathCapitalized, Project.GetCapitalizedFile(project.ApplicationIcon))))
Expand Down