You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-14 14:20:09 +00:00
com.unity.ide.visualstudio@2.0.14
## [2.0.14] - 2022-01-14 Integration: - Remove package version checking. ## [2.0.13] - 2022-01-12 Integration: - Fixed wrong path to analyzers in generated projects when using external packages. - Fixed selective project generation not creating Analyzer/LangVersion nodes. - Fixed asmdef references with Player projects. Documentation: - Added new documentation including ToC, overview, how to use and images.
This commit is contained in:
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,5 +1,24 @@
|
||||
# Code Editor Package for Visual Studio
|
||||
|
||||
## [2.0.14] - 2022-01-14
|
||||
|
||||
Integration:
|
||||
|
||||
- Remove package version checking.
|
||||
|
||||
|
||||
## [2.0.13] - 2022-01-12
|
||||
|
||||
Integration:
|
||||
|
||||
- Fixed wrong path to analyzers in generated projects when using external packages.
|
||||
- Fixed selective project generation not creating Analyzer/LangVersion nodes.
|
||||
- Fixed asmdef references with Player projects.
|
||||
|
||||
Documentation:
|
||||
|
||||
- Added new documentation including ToC, overview, how to use and images.
|
||||
|
||||
## [2.0.12] - 2021-10-20
|
||||
|
||||
Integration:
|
||||
@@ -8,7 +27,6 @@ Integration:
|
||||
- Only check package version once per Unity session.
|
||||
- Improved support for Visual Studio For Mac 2022.
|
||||
|
||||
|
||||
## [2.0.11] - 2021-07-01
|
||||
|
||||
Integration:
|
||||
@@ -20,7 +38,6 @@ Project generation:
|
||||
|
||||
- Use absolute paths for Analyzers and rulesets.
|
||||
|
||||
|
||||
## [2.0.10] - 2021-06-10
|
||||
|
||||
Project generation:
|
||||
|
||||
BIN
Documentation~/Images/external-tools-tab.png
Normal file
BIN
Documentation~/Images/external-tools-tab.png
Normal file
Binary file not shown.
2
Documentation~/TableOfContents.md
Normal file
2
Documentation~/TableOfContents.md
Normal file
@@ -0,0 +1,2 @@
|
||||
* [About Visual Studio Editor](index.md)
|
||||
* [Using the Visual Studio Editor package](using-visual-studio-editor.md)
|
||||
28
Documentation~/index.md
Normal file
28
Documentation~/index.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# Code Editor Package for Visual Studio
|
||||
|
||||
## About Visual Studio Editor
|
||||
|
||||
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.
|
||||
|
||||
## Installation
|
||||
|
||||
This package is a built-in package and installed by default.
|
||||
|
||||
**Note**: If you’re using a version of the Unity Editor before 2019.4, you’ll need to install this package through the package manager.
|
||||
|
||||
## Requirements
|
||||
|
||||
This version of the Visual Studio Editor package is compatible with the following versions of the Unity Editor:
|
||||
|
||||
* 2019.4 and later
|
||||
|
||||
To use this package, you must have the following third-party products installed:
|
||||
|
||||
* **On Windows**: Visual Studio 2019 version 16.9 or newer with Visual Studio Tools for Unity 4.0.9 or newer.
|
||||
* **On macOS**: Visual Studio for Mac 2019 version 8.9 or newer with Visual Studio Tools for Unity 2.0.9 or newer.
|
||||
|
||||
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).
|
||||
|
||||
## Submitting issues
|
||||
|
||||
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.
|
||||
23
Documentation~/using-visual-studio-editor.md
Normal file
23
Documentation~/using-visual-studio-editor.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Using the Visual Studio Editor package
|
||||
|
||||
To use the package, go to **Edit** > **Preferences** > **External Tools** > **External Script Editor** and select the version of **Visual Studio** you have installed. When you select this option, the window reloads and displays settings that control production of .csproj files.
|
||||
|
||||

|
||||
|
||||
## Generate .csproj files
|
||||
|
||||
Each setting in the table below enables or disables the production of .csproj files for a different type of package.When you click **Regenerate project files**, Unity updates the existing .csproj files and creates the necessary new ones based on the settings you choose.
|
||||
|
||||
|
||||
These settings control whether to generate .csproj files for any installed packages. For more information on how to install packages, see [Adding and removing packages](https://docs.unity3d.com/Manual/upm-ui-actions.html).
|
||||
|
||||
| **Property** | **Description** |
|
||||
|---|---|
|
||||
| **Embedded packages** | Any package that appears under your project’s Packages folder is an embedded package. An embedded package is not necessarily built-in; you can create your own packages and embed them inside your project. This setting is enabled by default.<br/><br/>For more information on embedded packages, see [Embedded dependencies](https://docs.unity3d.com/Manual/upm-embed.html). |
|
||||
| **Local packages** | Any package that you install from a local repository stored on your machine, but from outside of your Unity project. This setting is enabled by default. |
|
||||
| **Registry packages** | Any package that you install from either the official Unity registry or a custom registry. Packages in the Unity registry are available to install directly from the Package Manager. For more information about the Unity package registry, see The Package Registry section of the [Unity Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@1.8/manual/index.html#PackManRegistry). <br/><br/>For information on how to create and use custom registries in addition to the Unity registry, see [Scoped package registries](https://docs.unity3d.com/Manual/upm-scoped.html). |
|
||||
| **Git packages** | Any package you install directly from a Git repository using a URL. |
|
||||
| **Built-in packages** | Any package that is already installed as part of the default Unity installation. |
|
||||
| **Tarball packages** | Any package you install from a GZip tarball archive on the local machine, outside of your Unity project. |
|
||||
| **Unknown packages** | Any package which Unity cannot determine an origin for. This could be because the package doesn’t list its origin, or that Unity doesn’t recognize the origin listed. |
|
||||
| **Player projects** | For each player project, generate an additional .csproj file named ‘originalProjectName.Player.csproj’. This allows different project types to have their code included in Visual Studio’s systems, such as assembly definitions or testing suites. |
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(com)
|
||||
set(SOURCES
|
||||
@@ -10,4 +10,5 @@ set(SOURCES
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall")
|
||||
add_executable(COMIntegration ${SOURCES})
|
||||
set_property(TARGET COMIntegration PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
target_link_libraries(COMIntegration Shlwapi.lib)
|
||||
|
||||
Binary file not shown.
@@ -56,10 +56,10 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return relative == Path.GetFileName(relative);
|
||||
}
|
||||
|
||||
public static string MakeAbsolutePath(this string path, string projectDirectory)
|
||||
public static string MakeAbsolutePath(this string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) { return string.Empty; }
|
||||
return Path.IsPathRooted(path) ? path : Path.Combine(projectDirectory, path);
|
||||
return Path.IsPathRooted(path) ? path : Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
// returns null if outside of the project scope
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>19H1217</string>
|
||||
<string>19G2021</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -27,19 +27,19 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D4e</string>
|
||||
<string>12B45b</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>11.1</string>
|
||||
<string>11.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>20C63</string>
|
||||
<string>20A2408</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx11.1</string>
|
||||
<string>macosx11.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1240</string>
|
||||
<string>1220</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>12D4e</string>
|
||||
<string>12B45b</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Binary file not shown.
@@ -100,6 +100,9 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
using (solutionSyncMarker.Auto())
|
||||
{
|
||||
// We need the exact VS version/capabilities to tweak project generation (analyzers/langversion)
|
||||
RefreshCurrentInstallation();
|
||||
|
||||
SetupProjectSupportedExtensions();
|
||||
|
||||
// See https://devblogs.microsoft.com/setup/configure-visual-studio-across-your-organization-with-vsconfig/
|
||||
@@ -527,9 +530,12 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
projectBuilder.Append(" <ItemGroup>").Append(k_WindowsNewline);
|
||||
foreach (var reference in assembly.assemblyReferences.Where(i => i.sourceFiles.Any(ShouldFileBePartOfSolution)))
|
||||
{
|
||||
projectBuilder.Append(" <ProjectReference Include=\"").Append(reference.name).Append(GetProjectExtension()).Append("\">").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Project>{").Append(ProjectGuid(reference)).Append("}</Project>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Name>").Append(reference.name).Append("</Name>").Append(k_WindowsNewline);
|
||||
// If the current assembly is a Player project, we want to project-reference the corresponding Player project
|
||||
var referenceName = m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, reference.name);
|
||||
|
||||
projectBuilder.Append(" <ProjectReference Include=\"").Append(referenceName).Append(GetProjectExtension()).Append("\">").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Project>{").Append(ProjectGuid(referenceName)).Append("}</Project>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Name>").Append(referenceName).Append("</Name>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" </ProjectReference>").Append(k_WindowsNewline);
|
||||
}
|
||||
|
||||
@@ -741,16 +747,16 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
if (!string.IsNullOrEmpty(properties.RulesetPath))
|
||||
{
|
||||
lines.Add(@" <PropertyGroup>");
|
||||
lines.Add($" <CodeAnalysisRuleSet>{properties.RulesetPath.MakeAbsolutePath(ProjectDirectory).NormalizePathSeparators()}</CodeAnalysisRuleSet>");
|
||||
lines.Add($" <CodeAnalysisRuleSet>{properties.RulesetPath.MakeAbsolutePath().NormalizePathSeparators()}</CodeAnalysisRuleSet>");
|
||||
lines.Add(@" </PropertyGroup>");
|
||||
}
|
||||
|
||||
if (properties.Analyzers.Any())
|
||||
{
|
||||
lines.Add(@" <ItemGroup>");
|
||||
foreach (var analyzer in properties.Analyzers)
|
||||
foreach (var analyzer in properties.Analyzers.Distinct())
|
||||
{
|
||||
lines.Add($@" <Analyzer Include=""{analyzer.MakeAbsolutePath(ProjectDirectory).NormalizePathSeparators()}"" />");
|
||||
lines.Add($@" <Analyzer Include=""{analyzer.MakeAbsolutePath().NormalizePathSeparators()}"" />");
|
||||
}
|
||||
lines.Add(@" </ItemGroup>");
|
||||
}
|
||||
@@ -948,11 +954,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return ".csproj";
|
||||
}
|
||||
|
||||
private string ProjectGuid(string assemblyName)
|
||||
{
|
||||
return m_GUIDGenerator.ProjectGuid(m_ProjectName, assemblyName);
|
||||
}
|
||||
|
||||
private string ProjectGuid(Assembly assembly)
|
||||
{
|
||||
return m_GUIDGenerator.ProjectGuid(
|
||||
m_ProjectName,
|
||||
m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, assembly.name));
|
||||
return ProjectGuid(m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, assembly.name));
|
||||
}
|
||||
|
||||
private string SolutionGuid(Assembly assembly)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
internal static class SessionSettings
|
||||
{
|
||||
internal static string GetKey([CallerMemberName] string memberName = "")
|
||||
{
|
||||
return $"{typeof(SessionSettings).FullName}.{memberName}";
|
||||
}
|
||||
|
||||
public static bool PackageVersionChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return SessionState.GetBool(GetKey(), false);
|
||||
}
|
||||
set
|
||||
{
|
||||
SessionState.SetBool(GetKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d1e1d921eed0044e9fe0cd3ab6444ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,8 +11,6 @@ using System.Net.Sockets;
|
||||
using Microsoft.Unity.VisualStudio.Editor.Messaging;
|
||||
using Microsoft.Unity.VisualStudio.Editor.Testing;
|
||||
using UnityEditor;
|
||||
using UnityEditor.PackageManager;
|
||||
using UnityEditor.PackageManager.Requests;
|
||||
using UnityEngine;
|
||||
using MessageType = Microsoft.Unity.VisualStudio.Editor.Messaging.MessageType;
|
||||
|
||||
@@ -34,16 +32,11 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
private static readonly object _incomingLock = new object();
|
||||
private static readonly object _clientsLock = new object();
|
||||
|
||||
private static ListRequest _listRequest;
|
||||
|
||||
static VisualStudioIntegration()
|
||||
{
|
||||
if (!VisualStudioEditor.IsEnabled)
|
||||
return;
|
||||
|
||||
if (!SessionSettings.PackageVersionChecked)
|
||||
_listRequest = UnityEditor.PackageManager.Client.List();
|
||||
|
||||
RunOnceOnUpdate(() =>
|
||||
{
|
||||
// Despite using ReuseAddress|!ExclusiveAddressUse, we can fail here:
|
||||
@@ -134,35 +127,8 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
OnMessage(args.Message);
|
||||
}
|
||||
|
||||
private static void HandleListRequestCompletion()
|
||||
{
|
||||
const string packageName = "com.unity.ide.visualstudio";
|
||||
|
||||
if (_listRequest.Status == StatusCode.Success)
|
||||
{
|
||||
var package = _listRequest.Result.FirstOrDefault(p => p.name == packageName);
|
||||
|
||||
if (package != null
|
||||
&& Version.TryParse(package.version, out var packageVersion)
|
||||
&& Version.TryParse(package.versions.latest, out var latestVersion)
|
||||
&& packageVersion < latestVersion)
|
||||
{
|
||||
Debug.LogWarning($"Visual Studio Editor Package version {package.versions.latest} is available, we strongly encourage you to update from the Unity Package Manager for a better Visual Studio integration");
|
||||
}
|
||||
|
||||
SessionSettings.PackageVersionChecked = true;
|
||||
}
|
||||
|
||||
_listRequest = null;
|
||||
}
|
||||
|
||||
private static void OnUpdate()
|
||||
{
|
||||
if (_listRequest != null && _listRequest.IsCompleted)
|
||||
{
|
||||
HandleListRequestCompletion();
|
||||
}
|
||||
|
||||
lock (_incomingLock)
|
||||
{
|
||||
while (_incoming.Count > 0)
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
"name": "com.unity.ide.visualstudio",
|
||||
"displayName": "Visual Studio Editor",
|
||||
"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.",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"unity": "2019.4",
|
||||
"unityRelease": "25f1",
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.9"
|
||||
},
|
||||
"relatedPackages": {
|
||||
"com.unity.ide.visualstudio.tests": "2.0.12"
|
||||
"com.unity.ide.visualstudio.tests": "2.0.14"
|
||||
},
|
||||
"upmCi": {
|
||||
"footprint": "bccd4d0383df110ebef0c62f85b5ac7cb9464de3"
|
||||
"footprint": "8aa1049966a0586c636698ec81d764940b1dbe44"
|
||||
},
|
||||
"repository": {
|
||||
"url": "https://github.cds.internal.unity3d.com/unity/com.unity.ide.visualstudio.git",
|
||||
"type": "git",
|
||||
"revision": "8d436ff053b9c59677b5e9799208143553cd02d9"
|
||||
"revision": "f1e8af5df9e2507088a8622d173c9a7d5a03a882"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user