Skip to content
Permalink
Browse files

[VSPackage] Fix Xenko detection

  • Loading branch information
xen2 committed Aug 26, 2019
1 parent 285e1a4 commit 94d82c3c951f1368fc190171d006e2ba8d87dffe
Showing with 13 additions and 20 deletions.
  1. +13 −20 sources/assets/Xenko.Core.Assets/PackageSessionHelper.Solution.cs
@@ -67,30 +67,23 @@ public static async Task<PackageVersion> GetPackageVersion(string fullPath)
if (project.TypeGuid == VisualStudio.KnownProjectTypeGuid.CSharp || project.TypeGuid == VisualStudio.KnownProjectTypeGuid.CSharpNewSystem)
{
var projectPath = project.FullPath;
var packagePath = Path.ChangeExtension(projectPath, Package.PackageFileExtension);
if (File.Exists(packagePath))
{
var projectAssetsJsonPath = Path.Combine(Path.GetDirectoryName(projectPath), @"obj", LockFileFormat.AssetsFileName);
var projectAssetsJsonPath = Path.Combine(Path.GetDirectoryName(projectPath), @"obj", LockFileFormat.AssetsFileName);
#if !XENKO_LAUNCHER
if (!File.Exists(projectAssetsJsonPath))
{
var log = new LoggerResult();
await VSProjectHelper.RestoreNugetPackages(log, projectPath);
}
if (!File.Exists(projectAssetsJsonPath))
{
var log = new LoggerResult();
await VSProjectHelper.RestoreNugetPackages(log, projectPath);
}
#endif
if (File.Exists(projectAssetsJsonPath))
if (File.Exists(projectAssetsJsonPath))
{
var format = new LockFileFormat();
var projectAssets = format.Read(projectAssetsJsonPath);
foreach (var library in projectAssets.Libraries)
{
if (File.Exists(projectAssetsJsonPath))
if (library.Type == "package" && library.Name == "Xenko.Engine")
{
var format = new LockFileFormat();
var projectAssets = format.Read(projectAssetsJsonPath);
foreach (var library in projectAssets.Libraries)
{
if (library.Type == "package" && library.Name == "Xenko.Engine")
{
return new PackageVersion((string)library.Version.ToString());
}
}
return new PackageVersion((string)library.Version.ToString());
}
}
}

0 comments on commit 94d82c3

Please sign in to comment.
You can’t perform that action at this time.