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

ParseProject doesn't respect settings from Directory.Build.props #231

Open
christianbumann opened this issue Oct 24, 2023 · 1 comment
Open

Comments

@christianbumann
Copy link
Member

christianbumann commented Oct 24, 2023

In the file 'src\Directory.Build.props' settings for all projects were done.

example:

<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

Parsing the project

var projectInfo = context.ParseProject(project.Path, "Debug");
projectInfo.OutputPaths[0] // this returns e.g. C:/xyz/src/xyz/bin/Debug/net472'

Setting the AppendTargetFrameworkToOutputPath in the project file itself

var projectInfo = context.ParseProject(project.Path, "Debug");
projectInfo.OutputPaths[0] // this returns e.g. C:/xyz/src/xyz/bin/Debug'

Expected Behavior

Respect settings from Directory.Build.props

Current Behavior

It doesn't respect settings from Directory.Build.props

Additional information

  • Cake.Inbubator 8.0.0
  • The project file is the new project format <Project Sdk="Microsoft.NET.Sdk">
  • The issue is independent the target framework (net6.0, net472)
@NeishaS
Copy link

NeishaS commented Jul 17, 2024

I can confirm this issue as well.

I attempted to set the TargetFramework in Directory.Build.props with the following configuration:

<Project>
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
</Project>

Subsequently, I removed the TargetFramework from the .csproj files of multiple projects in my solution.
My objective was to streamline the process of upgrading the .NET framework version across all projects from a single location. The projects build without any issues in Visual Studio.

However, when invoking ParseProject within my CICD scripts, I noticed that in the CustomProjectParserResult object, the TargetFrameworkVersion property was set to null and the IsNetCore property was set to false. This resulted in the IsWebApplication() method returning false.

I'm currently using Cake.Incubator Version=8.0.0.

Addressing this issue would be greatly appreciated as it would enable the use of Directory.Build.props and help avoid redundancy in defining the same property values across multiple project files within a solution.

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

No branches or pull requests

2 participants