Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MSBuild version mismatch with new SDKs #1883

Merged
merged 8 commits into from
Aug 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pipelines/init.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
# Configuration: Release
Verbosity: Normal
DotNetVersion: "3.1.302"
DotNetVersion: "3.1.401"
CakeVersion: "0.32.1"
NuGetVersion: "4.9.2"
MonoVersion: ''
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ resources:

variables:
Verbosity: Diagnostic
DotNetVersion: "3.1.302"
DotNetVersion: "3.1.401"
CakeVersion: "0.32.1"
NuGetVersion: "4.9.2"
GitVersionVersion: "5.0.1"
Expand Down
31 changes: 23 additions & 8 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ Task("CreateMSBuildFolder")
"Microsoft.Build",
"Microsoft.Build.Framework",
"Microsoft.Build.Tasks.Core",
"Microsoft.Build.Utilities.Core",
"Microsoft.Build.Utilities.Core"
};

var msbuildRefLibraries = new []
{
"Microsoft.Build.Tasks.v4.0",
"Microsoft.Build.Tasks.v12.0",
"Microsoft.Build.Utilities.v4.0",
Comment on lines +212 to 216
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no NuGet packages for these but we can still copy them from the Mono MSBuild folder.

Expand Down Expand Up @@ -332,24 +336,35 @@ Task("CreateMSBuildFolder")
foreach (var library in msbuildLibraries)
{
var libraryFileName = library + ".dll";

// copy MSBuild from current Mono
var librarySourcePath = CombinePaths(monoMSBuildPath, libraryFileName);
var librarySourcePath = CombinePaths(env.Folders.Tools, library, "lib", "net472", libraryFileName);
var libraryTargetPath = CombinePaths(msbuildCurrentBinTargetFolder, libraryFileName);
if (FileHelper.Exists(librarySourcePath))
{
FileHelper.Copy(librarySourcePath, libraryTargetPath);
}
}

Information("Copying MSBuild depednencies...");
Information("Copying MSBuild Ref Libraries...");

foreach (var dependency in msBuildDependencies)
foreach (var refLibrary in msbuildRefLibraries)
{
var dependencyFileName = dependency + ".dll";
var refLibraryFileName = refLibrary + ".dll";

// copy MSBuild from current Mono
var dependencySourcePath = CombinePaths(monoMSBuildPath, dependencyFileName);
var refLibrarySourcePath = CombinePaths(monoMSBuildPath, refLibraryFileName);
var refLibraryTargetPath = CombinePaths(msbuildCurrentBinTargetFolder, refLibraryFileName);
if (FileHelper.Exists(refLibrarySourcePath))
{
FileHelper.Copy(refLibrarySourcePath, refLibraryTargetPath);
}
}

Information("Copying MSBuild dependencies...");

foreach (var dependency in msBuildDependencies)
{
var dependencyFileName = dependency + ".dll";
var dependencySourcePath = CombinePaths(env.Folders.Tools, dependency, "lib", "netstandard2.0", dependencyFileName);
var dependencyTargetPath = CombinePaths(msbuildCurrentBinTargetFolder, dependencyFileName);
if (FileHelper.Exists(dependencySourcePath))
{
Expand Down
4 changes: 2 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"DotNetInstallScriptURL": "https://dot.net/v1",
"DotNetChannel": "Preview",
"DotNetVersions": [
"3.1.302",
"3.1.401",
"5.0.100-preview.7.20366.6"
],
"RequiredMonoVersion": "6.6.0",
Expand Down Expand Up @@ -57,4 +57,4 @@
"RestoreOnlyTestAssets": [
"ProjectWithMissingType"
]
}
}
8 changes: 4 additions & 4 deletions build/Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@

<PackageReference Update="Newtonsoft.Json" Version="12.0.3" />

<PackageReference Update="Nuget.Packaging" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Packaging.Core" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="Nuget.Versioning" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.Packaging" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.Packaging.Core" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.ProjectModel" Version="$(NuGetPackageVersion)" />
<PackageReference Update="NuGet.Versioning" Version="$(NuGetPackageVersion)" />
Comment on lines +60 to +63
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only seemed to be an issue in the Linux build surprisingly


<PackageReference Update="OmniSharp.Extensions.LanguageServer" Version="0.18.0-beta0003" />
<PackageReference Update="OmniSharp.Extensions.LanguageProtocol.Testing" Version="0.18.0-beta0003" />
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.302"
"version": "3.1.401"
}
}
}
9 changes: 0 additions & 9 deletions src/OmniSharp.DotNetTest/VSTestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ public override async Task<GetTestStartInfoResponse> GetTestStartInfoAsync(strin
VerifyTestFramework(testFrameworkName);

var testCases = await DiscoverTestsAsync(new string[] { methodName }, runSettings, targetFrameworkVersion, cancellationToken);

SendMessage(MessageType.GetTestRunnerProcessStartInfoForRunSelected,
new
{
TestCases = testCases,
DebuggingEnabled = true,
RunSettings = LoadRunSettingsOrDefault(runSettings, targetFrameworkVersion)
});
Comment on lines -152 to -158
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been removed when I extracted out the GetTestRunningProcessStartInfo method


var testStartInfo = await GetTestRunnerProcessStartInfo(testCases, debuggingEnabled: false, runSettings, targetFrameworkVersion, cancellationToken);

return new GetTestStartInfoResponse
Expand Down
4 changes: 2 additions & 2 deletions test-assets/test-projects/global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.1.302"
"version": "3.1.401"
}
}
}
2 changes: 1 addition & 1 deletion tests/OmniSharp.MSBuild.Tests/ProjectLoadListenerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public async Task The_correct_sdk_version_is_emitted()
using (var host = CreateMSBuildTestHost(testProject.Directory, emitter.AsExportDescriptionProvider(LoggerFactory)))
{
Assert.Single(emitter.ReceivedMessages);
Assert.Equal(GetHashedFileExtension("3.1.302"), emitter.ReceivedMessages[0].SdkVersion);
Assert.Equal(GetHashedFileExtension("3.1.401"), emitter.ReceivedMessages[0].SdkVersion);
}
}

Expand Down
30 changes: 21 additions & 9 deletions tests/OmniSharp.Tests/DotNetCliServiceFacts.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OmniSharp.Services;
using NuGet.Versioning;
using OmniSharp.Services;
using TestUtility;
using Xunit;
using Xunit.Abstractions;
Expand All @@ -7,9 +8,20 @@ namespace OmniSharp.Tests
{
public class DotNetCliServiceFacts : AbstractTestFixture
{
private const string DotNetVersion = "3.1.401";
private int Major { get; }
private int Minor { get; }
private int Patch { get; }
private string Release { get; }

public DotNetCliServiceFacts(ITestOutputHelper output)
: base(output)
{
var version = SemanticVersion.Parse(DotNetVersion);
Major = version.Major;
Minor = version.Minor;
Patch = version.Patch;
Release = version.Release;
Comment on lines +11 to +24
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should make future SDK updates easier since the version string can be updated with a replace all.

}

[Fact]
Expand All @@ -21,10 +33,10 @@ public void GetVersion()

var version = dotNetCli.GetVersion();

Assert.Equal(3, version.Major);
Assert.Equal(1, version.Minor);
Assert.Equal(302, version.Patch);
Assert.Equal("", version.Release);
Assert.Equal(Major, version.Major);
Assert.Equal(Minor, version.Minor);
Assert.Equal(Patch, version.Patch);
Assert.Equal(Release, version.Release);
}
}

Expand All @@ -37,10 +49,10 @@ public void GetInfo()

var info = dotNetCli.GetInfo();

Assert.Equal(3, info.Version.Major);
Assert.Equal(1, info.Version.Minor);
Assert.Equal(302, info.Version.Patch);
Assert.Equal("", info.Version.Release);
Assert.Equal(Major, info.Version.Major);
Assert.Equal(Minor, info.Version.Minor);
Assert.Equal(Patch, info.Version.Patch);
Assert.Equal(Release, info.Version.Release);
}
}
}
Expand Down