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

func start does not honor Directory.Build.props when using $(SolutionDir) #4230

Open
arialdomartini opened this issue Jan 13, 2025 · 1 comment

Comments

@arialdomartini
Copy link

Version

4.0.6610

Description

A project which correctly builds and starts with func start, would fails in the presence of a Directory.Build.props containing $(SolutionDir), like in:

<Project>
  <PropertyGroup>
    <UseArtifactsOutput>true</UseArtifactsOutput>
    <ArtifactsPath>$(SolutionDir)/.build</ArtifactsPath>
  </PropertyGroup>
</Project>

Steps to reproduce

  • cd in the directory of a C# Azure Function source code
  • Add a file Directory.Build.props containing $(SolutionDir), like in:
<Project>
  <PropertyGroup>
    <UseArtifactsOutput>true</UseArtifactsOutput>
    <ArtifactsPath>$(SolutionDir)/.build</ArtifactsPath>
  </PropertyGroup>
</Project>
  • Run func start
  • Expected behavior: success
  • Actual result:
  Determining projects to restore...
  Restored C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj (in 309 ms).
CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\CSharpAzureFunction.GlobalUsings.g.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]

Error building project
CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\.NETCoreApp,Version=v9.0.AssemblyAttributes.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]
CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\CSharpAzureFunction.AssemblyInfo.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]

Build FAILED.

CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\CSharpAzureFunction.GlobalUsings.g.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]
CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\.NETCoreApp,Version=v9.0.AssemblyAttributes.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]
CSC : error CS2007: Unrecognized option: '/.build\obj\CSharpAzureFunction\debug\CSharpAzureFunction.AssemblyInfo.cs' [C:\prg\batch-server\service-bus\src\CSharpAzureFunction\CSharpAzureFunction.csproj]

Build succeeds in case either an absolute or a relative path is used, instead of $(SolutionDir).

@arialdomartini
Copy link
Author

Just noticed that using $(MSBuildThisFileDirectory) instead of SolutionDir the build succeeds, but func start would mistakenly create a bin directory in the project root, instead of where specified by ArtifactsPath.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant