Skip to content

Commit 0fe3b29

Browse files
simonferquelPackage Release Automation
authored andcommitted
Integration: - Monitor `additionalfile` extension by default. - Try opening a Visual Studio Code workspace if there's one (`.code-workspace` file in the Unity project). Project generation: - Identify `asset`, `meta`, `prefab` and `unity` files as `yaml` (Visual Studio Code). - Add `sln`/`csproj` file nesting (Visual Studio Code). - Improve SDK style project generation.
2 parents 5757c89 + 2ac1e48 commit 0fe3b29

18 files changed

+219
-196
lines changed

.yamato/CI.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ editors:
55
- version: 2020.3
66
- version: 2021.3
77
- version: 2022.3
8-
- version: 2023.1
8+
- version: 6000.0
99
- version: trunk
1010
platforms:
1111
- name: win
1212
type: Unity::VM
13-
image: scripting/scripting-bokken-images:latest
13+
image: package-ci/win10:v4
1414
flavor: b1.large
1515
envsetup: echo
1616
- name: mac
1717
type: Unity::VM::osx
18-
image: package-ci/mac:stable
18+
image: package-ci/macos-13:v4
1919
flavor: m1.mac
2020
envsetup: echo
2121
- name: linux
2222
type: Unity::VM
23-
image: package-ci/ubuntu:stable
23+
image: package-ci/ubuntu-22.04:v4
2424
flavor: b1.large
2525
envsetup: npm config set prefix '~/npm-global'
2626

@@ -113,7 +113,7 @@ run_vetting_test_project_{{ editor.version }}:
113113
name: Run vetting tests on {{ editor.version }}
114114
agent:
115115
type: Unity::VM
116-
image: package-ci/ubuntu:stable
116+
image: package-ci/ubuntu-22.04:v4
117117
flavor: b1.large
118118
variables:
119119
PATH: /home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin::/home/bokken/npm-global/bin
@@ -203,7 +203,7 @@ publish_release:
203203
{% endfor %}
204204
agent:
205205
type: Unity::VM
206-
image: package-ci/win10:stable
206+
image: package-ci/win10:v4
207207
flavor: b1.large
208208
variables:
209209
UPMCI_ENABLE_PACKAGE_SIGNING: 1

Assets/Editor/MSBuildTests.cs

Lines changed: 0 additions & 116 deletions
This file was deleted.

Packages/com.unity.ide.visualstudio.tests/Tests/Editor/CSProjectTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,25 @@ public void DefaultSyncSettings_WhenSynced_CreatesProjectFileFromDefaultTemplate
142142
" <FileAlignment>512</FileAlignment>",
143143
" <BaseDirectory>.</BaseDirectory>",
144144
" </PropertyGroup>",
145+
" <PropertyGroup>",
146+
" <NoWarn>0169;USG0001</NoWarn>",
147+
" <DefineConstants></DefineConstants>",
148+
" <AllowUnsafeBlocks>False</AllowUnsafeBlocks>",
149+
" </PropertyGroup>",
145150
" <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">",
146151
" <DebugSymbols>true</DebugSymbols>",
147152
" <DebugType>full</DebugType>",
148153
" <Optimize>false</Optimize>",
149154
$" <OutputPath>{m_Builder.Assembly.outputPath}</OutputPath>",
150-
$" <DefineConstants></DefineConstants>",
151155
" <ErrorReport>prompt</ErrorReport>",
152156
" <WarningLevel>4</WarningLevel>",
153-
" <NoWarn>0169;USG0001</NoWarn>",
154-
" <AllowUnsafeBlocks>False</AllowUnsafeBlocks>",
155157
" </PropertyGroup>",
156158
" <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">",
157159
" <DebugType>pdbonly</DebugType>",
158160
" <Optimize>true</Optimize>",
159161
$" <OutputPath>{@"Temp\bin\Release\".NormalizePathSeparators()}</OutputPath>",
160162
" <ErrorReport>prompt</ErrorReport>",
161163
" <WarningLevel>4</WarningLevel>",
162-
" <NoWarn>0169;USG0001</NoWarn>",
163-
" <AllowUnsafeBlocks>False</AllowUnsafeBlocks>",
164164
" </PropertyGroup>",
165165
" <PropertyGroup>",
166166
" <NoConfig>true</NoConfig>",

Packages/com.unity.ide.visualstudio.tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "com.unity.ide.visualstudio.tests",
44
"displayName": "Visual Studio Editor",
55
"description": "Code editor integration for supporting Visual Studio as code editor for unity. Adds support for generating csproj files for intellisense purposes, auto discovery of installations, etc.",
6-
"version": "2.0.21",
6+
"version": "2.0.23",
77
"unity": "2019.4",
88
"unityRelease": "25f1",
99
"dependencies": {

Packages/com.unity.ide.visualstudio/CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Code Editor Package for Visual Studio
22

3+
## [2.0.23] - 2025-02-03
4+
5+
Integration:
6+
7+
- Monitor `additionalfile` extension by default.
8+
- Try opening a Visual Studio Code workspace if there's one (`.code-workspace` file in the Unity project).
9+
10+
Project generation:
11+
12+
- Identify `asset`, `meta`, `prefab` and `unity` files as `yaml` (Visual Studio Code).
13+
- Add `sln`/`csproj` file nesting (Visual Studio Code).
14+
- Improve SDK style project generation.
15+
16+
17+
## [2.0.22] - 2023-10-03
18+
19+
Integration:
20+
21+
- Add support for `XDG_DATA_DIRS` and `.desktop` files on Linux for `VS Code` discovery.
22+
- Use compile-time platform-specifics instead of using runtime conditions.
23+
24+
Project generation:
25+
26+
- Suppress `USG0001` warnings.
27+
- Mark referenced assemblies as private (to not copy extra files to output directory when building).
28+
- Add Unity capability to SDK-Style projects.
29+
- Prevent circular dependency errors with SDK-Style projects.
30+
331
## [2.0.21] - 2023-09-05
432

533
Integration:

Packages/com.unity.ide.visualstudio/Documentation~/index.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## About Visual Studio Editor
44

5-
The Visual Studio Editor package provides the Unity Editor with support for Unity-specific features from the [Visual Studio Tools for Unity](https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/visual-studio-tools-for-unity) extension in [Visual Studio](https://visualstudio.microsoft.com/) and [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). These include IntelliSense auto-complete suggestions, C# editing, and debugging.
5+
The Visual Studio Editor package provides the Unity Editor with support for Unity-specific features from the [Visual Studio Tools for Unity](https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/visual-studio-tools-for-unity) extension in [Visual Studio](https://visualstudio.microsoft.com/) and the [Unity for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=visualstudiotoolsforunity.vstuc) extension in [Visual Studio Code](https://code.visualstudio.com/). These include IntelliSense auto-complete suggestions, C# editing, and debugging.
66

77
## Installation
88

@@ -18,11 +18,13 @@ This version of the Visual Studio Editor package is compatible with the followin
1818

1919
To use this package, you must have the following third-party products installed:
2020

21-
* **On Windows**: Visual Studio 2019 version 16.9 or newer with Visual Studio Tools for Unity 4.0.9 or newer.
22-
* **On macOS**: Visual Studio for Mac 2019 version 8.9 or newer with Visual Studio Tools for Unity 2.0.9 or newer.
21+
* **On Windows**: Visual Studio 2019 version 16.9 or newer with [Visual Studio Tools for Unity](https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/visual-studio-tools-for-unity) 4.0.9 or newer.
22+
* **On macOS**: Visual Studio Code with [Unity for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=visualstudiotoolsforunity.vstuc) 0.9.0 or newer.
2323

24-
For more information about using Visual Studio with Unity, see [Microsoft’s Visual Studio Tools for Unity documentation](https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/visual-studio-tools-for-unity).
24+
For more information on using Visual Studio with Unity, refer to Microsoft's [Visual Studio Tools for Unity](https://docs.microsoft.com/en-us/visualstudio/gamedev/unity/get-started/visual-studio-tools-for-unity) documentation.
25+
26+
For more information on using VS Code with Unity, refer to the Visual Studio Code [Unity development with VS code](https://code.visualstudio.com/docs/other/unity) documentation.
2527

2628
## Submitting issues
2729

28-
This package is maintained by Microsoft and Unity. Submit issues directly from Visual Studio and Visual Studio for Mac from the **Help** > **Submit Feedback** > **Report a Problem** menu. Unity will make this package accessible to the public on GitHub in the future.
30+
This package is maintained by Microsoft and Unity. Submit issues directly from the **Help** menu in Visual Studio (**Help** > **Submit Feedback** > **Report a Problem**) or Visual Studio Code (**Help** > **Report an Issue**). Unity will make this package accessible to the public on GitHub in the future.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Unity Technologies.
3+
* Copyright (c) Microsoft Corporation. All rights reserved.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
using System;
8+
using System.Collections.Generic;
9+
10+
namespace Microsoft.Unity.VisualStudio.Editor
11+
{
12+
internal enum GeneratorStyle
13+
{
14+
SDK = 1,
15+
Legacy = 2,
16+
}
17+
18+
internal static class GeneratorFactory
19+
{
20+
private static readonly Dictionary<GeneratorStyle, IGenerator> _generators = new Dictionary<GeneratorStyle, IGenerator>();
21+
22+
static GeneratorFactory()
23+
{
24+
_generators.Add(GeneratorStyle.SDK, new SdkStyleProjectGeneration());
25+
_generators.Add(GeneratorStyle.Legacy, new LegacyStyleProjectGeneration());
26+
}
27+
28+
public static IGenerator GetInstance(GeneratorStyle style)
29+
{
30+
var forceStyleString = OnSelectingCSProjectStyle();
31+
if (forceStyleString != null && Enum.TryParse<GeneratorStyle>(forceStyleString, out var forceStyle))
32+
style = forceStyle;
33+
34+
if (_generators.TryGetValue(style, out var result))
35+
return result;
36+
37+
throw new ArgumentException("Unknown generator style");
38+
}
39+
40+
private static string OnSelectingCSProjectStyle()
41+
{
42+
foreach (var method in TypeCacheHelper.GetPostProcessorCallbacks(nameof(OnSelectingCSProjectStyle)))
43+
{
44+
object retValue = method.Invoke(null, Array.Empty<object>());
45+
if (method.ReturnType != typeof(string))
46+
continue;
47+
48+
return retValue as string;
49+
}
50+
51+
return null;
52+
}
53+
}
54+
}

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/GeneratorFactory.cs.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/LegacyStyleProjectGeneration.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace Microsoft.Unity.VisualStudio.Editor
1212

1313
internal class LegacyStyleProjectGeneration : ProjectGeneration
1414
{
15-
internal override string StyleName => "Legacy";
15+
internal override GeneratorStyle Style => GeneratorStyle.Legacy;
1616

1717
public LegacyStyleProjectGeneration(string tempDirectory, IAssemblyNameProvider assemblyNameProvider, IFileIO fileIoProvider, IGUIDGenerator guidGenerator) : base(tempDirectory, assemblyNameProvider, fileIoProvider, guidGenerator)
1818
{
@@ -55,6 +55,7 @@ internal override void GetProjectHeader(ProjectProperties properties, out String
5555
headerBuilder.Append(@" <BaseDirectory>.</BaseDirectory>").Append(k_WindowsNewline);
5656
headerBuilder.Append(@" </PropertyGroup>").Append(k_WindowsNewline);
5757

58+
GetProjectHeaderProperties(properties, headerBuilder);
5859
GetProjectHeaderConfigurations(properties, headerBuilder);
5960

6061
// Explicit references
@@ -70,6 +71,25 @@ internal override void GetProjectHeader(ProjectProperties properties, out String
7071
GetProjectHeaderAnalyzers(properties, headerBuilder);
7172
}
7273

74+
internal static void GetProjectHeaderConfigurations(ProjectProperties properties, StringBuilder headerBuilder)
75+
{
76+
headerBuilder.Append(@" <PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "">").Append(k_WindowsNewline);
77+
headerBuilder.Append(@" <DebugSymbols>true</DebugSymbols>").Append(k_WindowsNewline);
78+
headerBuilder.Append(@" <DebugType>full</DebugType>").Append(k_WindowsNewline);
79+
headerBuilder.Append(@" <Optimize>false</Optimize>").Append(k_WindowsNewline);
80+
headerBuilder.Append(@" <OutputPath>").Append(properties.OutputPath).Append(@"</OutputPath>").Append(k_WindowsNewline);
81+
headerBuilder.Append(@" <ErrorReport>prompt</ErrorReport>").Append(k_WindowsNewline);
82+
headerBuilder.Append(@" <WarningLevel>4</WarningLevel>").Append(k_WindowsNewline);
83+
headerBuilder.Append(@" </PropertyGroup>").Append(k_WindowsNewline);
84+
headerBuilder.Append(@" <PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "">").Append(k_WindowsNewline);
85+
headerBuilder.Append(@" <DebugType>pdbonly</DebugType>").Append(k_WindowsNewline);
86+
headerBuilder.Append(@" <Optimize>true</Optimize>").Append(k_WindowsNewline);
87+
headerBuilder.Append($" <OutputPath>{@"Temp\bin\Release\".NormalizePathSeparators()}</OutputPath>").Append(k_WindowsNewline);
88+
headerBuilder.Append(@" <ErrorReport>prompt</ErrorReport>").Append(k_WindowsNewline);
89+
headerBuilder.Append(@" <WarningLevel>4</WarningLevel>").Append(k_WindowsNewline);
90+
headerBuilder.Append(@" </PropertyGroup>").Append(k_WindowsNewline);
91+
}
92+
7393
internal override void AppendProjectReference(Assembly assembly, Assembly reference, StringBuilder projectBuilder)
7494
{
7595
// If the current assembly is a Player project, we want to project-reference the corresponding Player project

0 commit comments

Comments
 (0)