admin管理员组文章数量:1279243
Consider the following sample .csproj file in the old format for .NetFramework
:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns=";>
<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>{4D2709F3-A2AF-4083-AB04-85BB258F9B2F}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ConsoleAppOldFormat</RootNamespace>
<AssemblyName>ConsoleAppOldFormat</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.IO" />
<Reference Include="System.Runtime" />
<Reference Include="System.ValueTuple" />
<Reference Include="System.Drawing" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
I want to convert the old .csproj style to the new SDK-style via .Net Upgrade Assistant.
It works fine, but I am a bit puzzled why some of my .NetFramework Reference
's are converted to PackageReference
and others are kept as Reference
. Some are completely removed. Here is the fully converted .csproj in the new SDK-style:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.IO" />
<Reference Include="System.Runtime" />
<Reference Include="System.ValueTuple" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="9.0.2" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.DirectoryServices" Version="9.0.2" />
</ItemGroup>
</Project>
As far as I understand, all of these Reference
's are part .NetFramework and should (?) therefore be included from the local installation/the GAC. Why are they converted to PackageReference
?
There is no C# code involved in this example. As far as I can tell, there is no difference if a Reference
is truly used or just defined.
Is there any logic behind that? Should I really prefer NuGet Packages in some cases and .NetFramework Reference
's in other cases?
本文标签:
版权声明:本文标题:c# - Why is .Net Upgrade Assistant changing some Reference Tags to PackageReference in new SDK-style? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741268405a2368888.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论