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

Lack of binding-files and bloated *.xproj update #3903

Open
maciej-izak opened this issue Sep 3, 2020 · 0 comments
Open

Lack of binding-files and bloated *.xproj update #3903

maciej-izak opened this issue Sep 3, 2020 · 0 comments

Comments

@maciej-izak
Copy link

maciej-izak commented Sep 3, 2020

Description

In the case of more advanced csproj/fsproj files with <Import Project="foo.props" />, PAKET is not able to generate app.config/web.config. It happens when item TargetFrameworks from PropertyGroup is moved from main project file to some *.props file and when framework is defined in paket.dependencies file (for example framework: net48, netcoreapp3.1). I need custom props and targets files beacuse I have large set of projects with many common parts. Also my project layout is related to BaseIntermediateOutputPath problem:

dotnet/msbuild#1603

With custom props/targets files the csproj/fsproj looks much better, but the solution in above issue affects PAKET in strange way. The MSBuild is detected as MSBuild v4, and instead of simple single entry:

<Import Project=".paket\Paket.Restore.targets" />

I have such monster in my project file:

  <Choose>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And $(TargetFrameworkVersion) == 'v4.8'">
      <ItemGroup>
        <Reference Include="Newtonsoft.Json">
          <HintPath>packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
    <When Condition="$(TargetFrameworkIdentifier) == '.NETCoreApp' And $(TargetFrameworkVersion) == 'v3.1'">
      <ItemGroup>
        <Reference Include="Newtonsoft.Json">
          <HintPath>packages\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
          <Private>True</Private>
          <Paket>True</Paket>
        </Reference>
      </ItemGroup>
    </When>
  </Choose>

Repro steps

Move TargetFrameworks from PropertyGroup from main project file to new *.props file and import this new *.props into main project. Add framework: net48, netcoreapp3.1 into paket.dependencies file, then try to execute dotnet paket install --create-new-binding-files.

Example project with bat script attached in zip archive: PaketTest.zip.

Expected behavior

PAKET should be able to detect TargetFrameworks in imported *.props files for proper generation of binding-files and should detect proper MSBuild version.

Actual behavior

If TargetFrameworks is moved to *.props file, generation/update of binding-files doesn't work (is simply ignored) and bloated <Choose> section is added to project.

Known workarounds

Add TargetFrameworks to main project file and live with bloated <Choose>...

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

1 participant