com.unity.ide.visualstudio@2.0.11

## [2.0.11] - 2021-07-01

Integration:

- Added support for Visual Studio and Visual Studio For Mac 2022.
- Fixed an issue when the package was enabled for background processes.

Project generation:

- Use absolute paths for Analyzers and rulesets.

## [2.0.10] - 2021-06-10

Project generation:

- Improved project generation performance when a file is moved, deleted or modified.

Integration:

- Improved Inner-loop performance by avoiding to call the package manager when looking up `vswhere` utility.
- Fixed a network issue preventing the communication between Visual Studio and Unity on Windows.
This commit is contained in:
Unity Technologies
2021-07-01 00:00:00 +00:00
parent b0f2251c48
commit f6444c620d
22 changed files with 428 additions and 274 deletions

View File

@@ -5,8 +5,6 @@
*--------------------------------------------------------------------------------------------*/
using System;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Microsoft.Unity.VisualStudio.Editor
@@ -16,27 +14,19 @@ namespace Microsoft.Unity.VisualStudio.Editor
public const char WinSeparator = '\\';
public const char UnixSeparator = '/';
// Safe for packages as we use packageInfo.resolvedPath, so this should work in library package cache as well
public static string[] FindPackageAssetFullPath(string assetfilter, string filefilter)
public static string GetPackageAssetFullPath(params string[] components)
{
return AssetDatabase.FindAssets(assetfilter)
.Select(AssetDatabase.GUIDToAssetPath)
.Where(assetPath => assetPath.Contains(filefilter))
.Select(asset =>
{
var packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssetPath(asset);
return Normalize(packageInfo.resolvedPath + asset.Substring(packageInfo.assetPath.Length));
})
.ToArray();
// Unity has special IO handling of Packages and will resolve those path to the right package location
return Path.GetFullPath(Path.Combine("Packages", "com.unity.ide.visualstudio", Path.Combine(components)));
}
public static string GetAssetFullPath(string asset)
{
var basePath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
return Path.GetFullPath(Path.Combine(basePath, Normalize(asset)));
return Path.GetFullPath(Path.Combine(basePath, NormalizePathSeparators(asset)));
}
public static string Normalize(string path)
public static string NormalizePathSeparators(this string path)
{
if (string.IsNullOrEmpty(path))
return path;
@@ -65,12 +55,18 @@ namespace Microsoft.Unity.VisualStudio.Editor
return relative == Path.GetFileName(relative);
}
public static string MakeAbsolutePath(this string path, string projectDirectory)
{
if (string.IsNullOrEmpty(path)) { return string.Empty; }
return Path.IsPathRooted(path) ? path : Path.Combine(projectDirectory, path);
}
// returns null if outside of the project scope
internal static string MakeRelativeToProjectPath(string fileName)
{
var basePath = Path.GetFullPath(Path.Combine(Application.dataPath, ".."));
fileName = Normalize(fileName);
fileName = NormalizePathSeparators(fileName);
if (!Path.IsPathRooted(fileName))
fileName = Path.Combine(basePath, fileName);
@@ -82,6 +78,5 @@ namespace Microsoft.Unity.VisualStudio.Editor
.Substring(basePath.Length)
.Trim(Path.DirectorySeparatorChar);
}
}
}