NuGet/Home

Nuget doesn't show target frameworks information in UI if there is no dependency

Open

#7.160 aberto em 31 de jul. de 2018

Ver no GitHub
 (6 comments) (0 reactions) (0 assignees)HTML (292 forks)batch import
Functionality:VisualStudioUIPriority:2Product:VS.ClientType:Bughelp wanted

Métricas do repositório

Stars
 (1.459 stars)
Métricas de merge de PR
 (Mesclagem média 464d 23h) (1 fundiu PR em 30d)

Description

Details about Problem

I was trying to pack, a library, managed by a legacy csproj file. Nuget pack command was able to pack the library excluding the target framework version information in the nuspec file. I was expecting nuget pack to read the target framework version from the legacy csproj file and include that information with the nuspec file

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):

NuGet Version: 4.3.0.4406

VS version (if appropriate): 15.6.6

OS version (i.e. win10 v1607 (14393.321)): win10 pro

Detailed repro steps so we can see the same problem

  1. Consider a legacy Test.csproj

  2. nuget pack Test.csproj

...

Other suggested things

Verbose Logs

NuGet Version: 4.3.0.4406
Attempting to build package from 'TestLibrary.csproj'.
MSBuild auto-detection: using msbuild version '15.6.85.37198' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'd:\Documents\Visual Studio 2017\Projects\TestLibrary\TestLibrary\bin\Debug'.
Add file 'd:\Documents\Visual Studio 2017\Projects\TestLibrary\TestLibrary\bin\Debug\TestLibrary.dll' to package as 'lib\net471\TestLibrary.dll'
WARNING: Description was not specified. Using 'Description'.
WARNING: Author was not specified. Using 'g.raman'.

Id: TestLibrary
Version: 1.0.0
Authors: g.raman
Description: Description
Dependencies:

Added file '[Content_Types].xml'.
Added file '_rels/.rels'.
Added file 'lib/net471/TestLibrary.dll'.
Added file 'package/services/metadata/core-properties/cb5d4cb0aa424bcd9019c62abfa9786f.psmdcp'.
Added file 'TestLibrary.nuspec'.

Successfully created package 'd:\Documents\Visual Studio 2017\Projects\TestLibrary\TestLibrary\TestLibrary.1.0.0.nupkg'.

Sample Project

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>1ed5b2c7-d3b8-464c-94e6-b14c9934fc00</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>TestLibrary</RootNamespace>
    <AssemblyName>TestLibrary</AssemblyName>
    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System"/>
    
    <Reference Include="System.Core"/>
    <Reference Include="System.Xml.Linq"/>
    <Reference Include="System.Data.DataSetExtensions"/>
    
    
    <Reference Include="Microsoft.CSharp"/>
    
    <Reference Include="System.Data"/>
    
    <Reference Include="System.Net.Http"/>
    
    <Reference Include="System.Xml"/>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Class1.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

Very helpful if you can zip a project and paste into this issue!

Guia do colaborador