简体   繁体   中英

How to set up a UWP class library with the new csproj format with MSBuild.Extras?

I'm trying to create a class library that uses UWP controls (the lower the version the better), and I want it to use the new csproj format.

I figured MSBuild.Sdk.Extras is what I'm after. After reading the Readme I did the following:

  1. I created a .NET Standard class library project and replaced its content with the following:
<Project Sdk="MSBuild.Sdk.Extras">
  <PropertyGroup>
    <TargetFrameworks>uap</TargetFrameworks>
  </PropertyGroup>
</Project>
  1. I added a global.json file with the following content:
{
  "msbuild-sdks": {
    "MSBuild.Sdk.Extras": "2.0.54"
  }
}

But when I try to build the project, I get the following error:

D:\Users\Shimmy\Source\Repos....csproj: error: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. >C:\Users\Shimmy.nuget\packages\msbuild.sdk.extras\2.0.54\Build\Platforms\Windows.targets

I'm willing to hear about other ways of UWP creating class libraries as long as it uses the new format.

This worked:

<Project Sdk="MSBuild.Sdk.Extras">
  <PropertyGroup>
    <TargetFramework>uap10.0</TargetFramework>
  </PropertyGroup>
</Project>

Or one of the specific versions, ie uap10.0.16299 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM