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
4 changes: 2 additions & 2 deletions src/Fluidify/build/Fluidify.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
Condition="'@(Fluidify)' != ''">
<ItemGroup>
<Fluidify Condition="'%(Fluidify.Destination)' == ''">
<OutputPath>%(RootDir)%(Directory)%(Filename)</OutputPath>
<OutputPath>%(RelativeDir)%(Filename)</OutputPath>
</Fluidify>
<Fluidify Condition="'%(Fluidify.Destination)' != '' and $([System.IO.Path]::IsPathRooted('%(Fluidify.Destination)'))">
<OutputPath>%(Fluidify.Destination)</OutputPath>
</Fluidify>
<Fluidify Condition="'%(Fluidify.Destination)' != '' and !$([System.IO.Path]::IsPathRooted('%(Fluidify.Destination)'))">
<OutputPath>$(MSBuildProjectDirectory)\%(Fluidify.Destination)</OutputPath>
<OutputPath>%(Fluidify.Destination)</OutputPath>
</Fluidify>
</ItemGroup>
</Target>
Expand Down
18 changes: 18 additions & 0 deletions tests/Fluidify.Tests.Functional/CompileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ public async Task GeneratedCsFile_CompileFalse_IsExcludedFromCompilation()
"Expected a missing type/namespace compiler error");
}

[Test]
public async Task RebuildWithExistingOutput_NoDuplicateCompileWarning()
{
string compileAppProject = Path.Combine(CompileAppDir, "CompileApp.csproj");

// First build: generates the .cs file on disk
(int ExitCode, string Output) firstBuild = await RunDotnet($"build \"{compileAppProject}\" --force");
Assert.That(firstBuild.ExitCode, Is.EqualTo(0),
$"First build failed:\n{firstBuild.Output}");

// Second build: SDK glob picks up the file AND Fluidify adds it — should not duplicate
(int ExitCode, string Output) secondBuild = await RunDotnet($"build \"{compileAppProject}\" --force");
Assert.That(secondBuild.ExitCode, Is.EqualTo(0),
$"Second build failed:\n{secondBuild.Output}");
Assert.That(secondBuild.Output, Does.Not.Contain("CS2002"),
$"Duplicate compile warning detected on rebuild:\n{secondBuild.Output}");
}

private static async Task<(int ExitCode, string Output)> RunDotnet(string arguments)
{
ProcessStartInfo psi = new ProcessStartInfo("dotnet", arguments)
Expand Down