VS 2017, RS 2017.1.3 Incorrect "Duplicate Definition" error for net45/netcore projects with default compilation items disabled

Completed

I have VS 2017.3 and Reshaper 2017.1.3 installed. 

On all projects where:

a) Both net45 and netcoreapp are set as a target platforms, e.g.

<TargetFrameworks>net45;netcoreapp1.1</TargetFrameworks>

AND

b) The set of files with source code is explicitly set, e.g. 

<EnableDefaultCompileItems>false</EnableDefaultCompileItems>

and then source codes are set via <ItemGroup>

Reshaper shows "Duplicate Definition" for every class in the project. The problem repeats for every solution where both conditions are met. 

Below is a full copy of one of the problematic projects. It does not matter what is in DataSourceRequest.cs, any class will be falsely recognized as "duplicate definition".

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netcoreapp1.1</TargetFrameworks>
<DefineConstants Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">NETCORE</DefineConstants>
<DefineConstants Condition=" '$(TargetFramework)' == 'net45' ">NET45</DefineConstants>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
</PropertyGroup>

<ItemGroup>
<Compile Include="DataSourceRequest.cs" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net45'">
<Reference Include="System.Web" />
<PackageReference Include="Microsoft.AspNet.Mvc">
<Version>5.2.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.Razor">
<Version>3.2.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.WebPages">
<Version>3.2.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.Web.Infrastructure">
<Version>1.0.0.0</Version>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.1'">
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
</ItemGroup>
</Project>

3 comments
Comment actions Permalink

Hello Nikolay!

 

Please try installing latest ReSharper 2017.2 EAP build - https://www.jetbrains.com/resharper/eap/ and check if the issue is reproduced.

Thank you.

0
Comment actions Permalink

After an hour of using it seems working. Thank you!

0
Comment actions Permalink

You are welcome!

Please feel free to contact us in case of any questions.

0

Please sign in to leave a comment.