Skip to content
Merged
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
30 changes: 30 additions & 0 deletions test/Microsoft.NET.Build.Tests/RoslynBuildTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ public void DotNet_ToolsetPackage(bool useSharedCompilation, Language language)
VerifyCompiler(buildCommand, DotNetExecCompilerFileName(language), CoreTargetFrameworkName, useSharedCompilation, toolsetPackage: true);
}

/// <summary>
/// SDK side test for <see href="https://github.com/dotnet/roslyn/pull/80993"/>.
/// </summary>
[FullMSBuildOnlyFact]
public void UsingCscManually()
{
var testInstance = _testAssetsManager.CreateTestDirectory();

File.WriteAllText(Path.Join(testInstance.Path, "Test.csproj"), $"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>{ToolsetInfo.CurrentTargetFramework}</TargetFramework>
</PropertyGroup>
<Target Name="CustomTarget">
<Csc Sources="File.cs" />
</Target>
</Project>
""");

File.WriteAllText(Path.Join(testInstance.Path, "File.cs"), """
using System.Linq;
System.Console.WriteLine();
""");

new MSBuildCommand(Log, "CustomTarget", testInstance.Path)
.WithWorkingDirectory(testInstance.Path)
.Execute()
.Should().Pass();
}

private TestAsset CreateProject(bool useSharedCompilation, Language language, Action<TestProject>? configure = null, [CallerMemberName] string callingMethod = "")
{
var (projExtension, sourceName, sourceText) = language switch
Expand Down