-
Notifications
You must be signed in to change notification settings - Fork 120
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
Feature Request: Reference package instead of referencing Dll files #272
Comments
@moh-hassan thank you for your report. If I understood you correctly, both of these features are already implemented in this tool. Are they not working correctly? If so, could you please provide the case for us to reproduce the issue? |
Thanks @andrew-boyarshin for reply. |
When I run the tool on the your test case, I get the following csproj (you've provided a part of the result, I am posting it for further reference): <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{7238CC8F-C533-4DF5-8770-5D9EF82D91A9}</ProjectGuid>
<TargetFramework>net462</TargetFramework>
<AssemblyTitle>CommonComponents</AssemblyTitle>
<Product>CommonComponents</Product>
<Copyright>Copyright © 2016</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.2.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.2.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Autofac.4.2.1\lib\net45\Autofac.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Autofac.Extras.Plugins\Autofac.Extras.Plugins.csproj" />
</ItemGroup>
</Project> The only issue I see here is Autofac assembly being referenced twice: once properly (as PackageReference), and once (as Reference) erroneously. I'll look into it. |
After a short investigation I consider the Autofac behavior correct. |
I created this feature and it is supposed to look in your NuGet settings (i.e. I haven't checked recently to make sure that it is still working as the newer versions of this migrator seem to have a couple of issues in this area and I ended up using the VS tool to migrate to PackageReference prior to doing a migration with this tool. Sorry, that's a bit vague, but if you are able to check if your NuGet settings align with the HintPath, then we can establish for sure if it is a bug. There was a unit test for it I believe so perhaps it is still working as originally intended. I've not got much time to look at this at the mo. |
@mungojam |
@andrew-boyarshin <HintPath>..\..\..\packages\Autofac.4.2.1\lib\net45\Autofac.dll</HintPath> The HintPath Point to folder in the format:
which insure that it's a package. |
It does this, but only if the NuGet package location the
or
I've restructured your example's folder structure and added a nuget.config to demonstrate that it works for case 1 when run with CommonComponentsWithNugetConfig.zip <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{7238CC8F-C533-4DF5-8770-5D9EF82D91A9}</ProjectGuid>
<TargetFramework>net462</TargetFramework>
<AssemblyTitle>CommonComponents</AssemblyTitle>
<Product>CommonComponents</Product>
<Copyright>Copyright © 2016</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.2.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Autofac.Extras.Plugins\Autofac.Extras.Plugins.csproj" />
</ItemGroup>
</Project> |
@moh-hassan. I meant to ask, which case are you relying on for the packages to work prior to the migration? 1 or 2 |
@mungojam |
If |
@andrew-boyarshin
An option in commandline to ignore/use package directory / or NuGet.config is good. |
The generated project reference dll files and it's supposed to reference the nuget package
so instead of any dll file which is defined in HintPath:
It should be:
These packages are defined in the file: Packages.config.
Also, these Assemblies are reference by default in the project, so no need to reference it:
The text was updated successfully, but these errors were encountered: