You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-15 06:40:08 +00:00
com.unity.ide.visualstudio@2.0.22
## [2.0.22] - 2023-10-03 Integration: - Add support for `XDG_DATA_DIRS` and `.desktop` files on Linux for `VS Code` discovery. - Use compile-time platform-specifics instead of using runtime conditions. Project generation: - Suppress `USG0001` warnings. - Mark referenced assemblies as private (to not copy extra files to output directory when building). - Add Unity capability to SDK-Style projects. - Prevent circular dependency errors with SDK-Style projects.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEditor.Compilation;
|
||||
@@ -13,6 +14,8 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
internal class SdkStyleProjectGeneration : ProjectGeneration
|
||||
{
|
||||
internal override string StyleName => "SDK";
|
||||
|
||||
internal class SdkStyleAssemblyNameProvider : AssemblyNameProvider
|
||||
{
|
||||
// disable PlayerGeneration with SdkStyle projects
|
||||
@@ -27,12 +30,42 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
}
|
||||
|
||||
internal static readonly string[] SupportedCapabilities = new string[]
|
||||
{
|
||||
"Unity",
|
||||
};
|
||||
|
||||
internal static readonly string[] UnsupportedCapabilities = new string[]
|
||||
{
|
||||
"LaunchProfiles",
|
||||
"SharedProjectReferences",
|
||||
"ReferenceManagerSharedProjects",
|
||||
"ProjectReferences",
|
||||
"ReferenceManagerProjects",
|
||||
"COMReferences",
|
||||
"ReferenceManagerCOM",
|
||||
"AssemblyReferences",
|
||||
"ReferenceManagerAssemblies",
|
||||
};
|
||||
|
||||
internal override void GetProjectHeader(ProjectProperties properties, out StringBuilder headerBuilder)
|
||||
{
|
||||
headerBuilder = new StringBuilder();
|
||||
|
||||
headerBuilder.Append(@"<Project ToolsVersion=""Current"" Sdk=""Microsoft.NET.Sdk"">").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@"<Project ToolsVersion=""Current"">").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@" <!-- Generated file, do not modify, your changes will be overwritten (use AssetPostprocessor.OnGeneratedCSProject) -->").Append(k_WindowsNewline);
|
||||
|
||||
// Prevent circular dependency issues see https://github.com/microsoft/vscode-dotnettools/issues/401
|
||||
// We need a dedicated subfolder for each project in obj, else depending on the build order, nuget cache files could be overwritten
|
||||
// We need to do this before common.props, else we'll have a MSB3539 The value of the property "BaseIntermediateOutputPath" was modified after it was used by MSBuild
|
||||
headerBuilder.Append(@" <PropertyGroup>").Append(k_WindowsNewline);
|
||||
headerBuilder.Append($" <BaseIntermediateOutputPath>{@"Temp\obj\$(Configuration)\$(MSBuildProjectName)".NormalizePathSeparators()}</BaseIntermediateOutputPath>").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@" <IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@" </PropertyGroup>").Append(k_WindowsNewline);
|
||||
|
||||
// Supported capabilities
|
||||
GetCapabilityBlock(headerBuilder, "Sdk.props", "Include", SupportedCapabilities);
|
||||
|
||||
headerBuilder.Append(@" <PropertyGroup>").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@" <GenerateAssemblyInfo>false</GenerateAssemblyInfo>").Append(k_WindowsNewline);
|
||||
headerBuilder.Append(@" <EnableDefaultItems>false</EnableDefaultItems>").Append(k_WindowsNewline);
|
||||
@@ -76,7 +109,21 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
|
||||
internal override void GetProjectFooter(StringBuilder footerBuilder)
|
||||
{
|
||||
// Unsupported capabilities
|
||||
GetCapabilityBlock(footerBuilder, "Sdk.targets", "Remove", UnsupportedCapabilities);
|
||||
|
||||
footerBuilder.Append("</Project>").Append(k_WindowsNewline);
|
||||
}
|
||||
|
||||
internal static void GetCapabilityBlock(StringBuilder footerBuilder, string import, string attribute, string[] capabilities)
|
||||
{
|
||||
footerBuilder.Append($@" <Import Project=""{import}"" Sdk=""Microsoft.NET.Sdk"" />").Append(k_WindowsNewline);
|
||||
footerBuilder.Append(@" <ItemGroup>").Append(k_WindowsNewline);
|
||||
foreach (var capability in capabilities)
|
||||
{
|
||||
footerBuilder.Append($@" <ProjectCapability {attribute}=""{capability}"" />").Append(k_WindowsNewline);
|
||||
}
|
||||
footerBuilder.Append(@" </ItemGroup>").Append(k_WindowsNewline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user