[英]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.