Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ public void CanUpdateProjectFileWithStandardProjectFileXml(string xml)
canUpdate.ShouldBe(true);
}

[TestCase(@"
<Project Sdk=""Microsoft.NET.Sdk.Web"">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
")]
[Category(NoMono)]
[Description(NoMonoDescription)]
public void CanUpdateProjectFileWithStandardWebProjectFileXml(string xml)
{
using var projectFileUpdater = new ProjectFileUpdater(log, fileSystem);

var canUpdate = projectFileUpdater.CanUpdateProjectFile(XElement.Parse(xml));

canUpdate.ShouldBe(true);
}

[TestCase(@"
<Project Sdk=""SomeOtherProject.Sdk"">
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ internal bool CanUpdateProjectFile(XElement xmlRoot)
return false;
}

var supportedSdk = "Microsoft.NET.Sdk";
var supportedSdks = new[] { "Microsoft.NET.Sdk", "Microsoft.NET.Sdk.Web" };
var sdkAttribute = xmlRoot.Attribute("Sdk");
if (sdkAttribute == null || sdkAttribute.Value != supportedSdk)
if (sdkAttribute == null || !supportedSdks.Contains(sdkAttribute.Value))
{
log.Warning($"Specified project file Sdk ({sdkAttribute?.Value}) is not supported, please ensure the project sdk is {supportedSdk}.");
var supportedSdkString = string.Join("|", supportedSdks);
log.Warning($"Specified project file Sdk ({sdkAttribute?.Value}) is not supported, please ensure the project sdk is of the following: {supportedSdkString}.");
return false;
}

Expand Down