简体   繁体   English

我可以将这个旧的csproj迁移到VS2017 csproj吗?

[英]Can I migrate this old csproj to VS2017 csproj?

I want to simplify my PCL csproj and I can't seem to find the appropriate TargetFrameworks .. 我想简化我的PCL csproj,我似乎无法找到合适的TargetFrameworks ..

This is my old csproj: 这是我的旧csproj:

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{D035A2E6-EF3E-4F50-B6D7-396F83FE313F}</ProjectGuid>
    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <RootNamespace>PCL.Acme</RootNamespace>
    <AssemblyName>PCL.Acme</AssemblyName>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <TargetFrameworkProfile>Profile151</TargetFrameworkProfile>
  </PropertyGroup>

The current nuget has a framework folder formatted like portable46-net451%2Bwin81%2Bwpa81 . 当前的nuget有一个框架文件夹,格式为portable46-net451%2Bwin81%2Bwpa81 I cannot target netstandard1.2 because I have a dependency on another PCL... 我无法定位netstandard1.2因为我依赖另一个PCL ...

Any help is appreciated. 任何帮助表示赞赏。

Update 更新

This csproj format made it possible to reference my old PCL nuget package. 这种csproj格式使我可以引用我的旧PCL nuget包。 Now I can start migrating the PCL.Acme.Another.Library project. 现在我可以开始迁移PCL.Acme.Another.Library项目了。

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netstandard1.2</TargetFrameworks>
    <PackageId>PCL.Acme</PackageId>
    <Authors>Acme</Authors>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <PackageTargetFallback>
      $(PackageTargetFallback);portable46-net451+win81+wpa81
    </PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="PCL.Acme.Another.Library" Version="1.0.0" />
  </ItemGroup>
</Project>

I would recreate csproj (start over) with new format it's much easier. 我会用新格式重新创建csproj(重新开始)它会更容易。 This blog post is really helpful https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/ 这篇博文非常有用https://natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/

Edit: all supported target frameworks https://docs.microsoft.com/en-us/dotnet/standard/frameworks 编辑:所有受支持的目标框架https://docs.microsoft.com/en-us/dotnet/standard/frameworks

Edit2: EDIT2:

<PackageTargetFallback>
    $(PackageTargetFallback);portable-net45+win8+wpa81+wp8
</PackageTargetFallback>

Might help as well. 可能也有帮助。 More info here https://docs.microsoft.com/en-us/dotnet/core/tools/csproj 更多信息请访问https://docs.microsoft.com/en-us/dotnet/core/tools/csproj

If link goes down 如果链接断开

Class library 类库

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>
</Project>

Console app 控制台应用

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>
</Project>

Test project 测试项目

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
    <PackageReference Include="xunit" Version="2.2.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
  </ItemGroup>
</Project>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VS2017 CSPROJ项目中的Nuget打包 - Nuget packaging in VS2017 csproj project VS2017 CSPROJ没有ItemGroup标签 - VS2017 csproj don't have ItemGroup tag 如何在VS 2017中将csproj文件更改回旧格式 - How to change the csproj file back to old format in VS 2017 MSBuild打开vs2017 csproj文件时出错(无法识别工具版本“ 15.0”…) - MSBuild error opening vs2017 csproj files (The tools version “15.0” is unrecognized…) VS2017调试Razor class库时csproj/sln路径名中不能有“#”号 - “#” sign cannot be in csproj/sln pathname when debugging Razor class library in VS2017 是否可以将 xaml.cs 连接到 VS2017 csproj 格式的对应 xaml? - Is it possible to connect xaml.cs to corrsponding xaml in VS2017 csproj format? 如何将旧的 WinForms 项目迁移到新的 VS2017 项目格式 - How-to migrate old WinForms projects to the new VS2017 project format 使用VS2017样式的csproj定位Xamarin Mobile Mac - Targeting Xamarin Mobile Mac using VS2017-style csproj 我必须使用旧的.net技术做一个项目,VS2017与旧技术兼容吗? - I have to do a project using old .net technologies, is VS2017 compatible with old technologies? 如何将VS2017与Unity 2018一起使用 - How can I use VS2017 with Unity 2018
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM