【问题标题】:why do I get parameter targetplatformversion cannot be null in microsoft visual studio为什么我在 Microsoft Visual Studio 中获取参数 targetplatformversion 不能为空
【发布时间】:2016-09-05 12:53:23
【问题描述】:

大家好,我正在尝试将 Windows phone 8.1 应用程序迁移到 Windows 10,并且我已仔细按照说明进行操作,但我总是收到错误 Prameter targetplatformVersion cannot be null。但它不是空的,这是我的 .csproj 文件中的代码

    <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
    <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
    <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
    <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
    <ProductVersion>10.0.20506</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{7C06E7B5-5C0A-4D9E-BA59-D2A359546261}</ProjectGuid>
    <ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MedeTraxAlert_Phase2</RootNamespace>
    <AssemblyName>MedeTraxAlert_Phase2</AssemblyName>
    <SilverlightVersion>
    </SilverlightVersion>
    <SilverlightApplication>true</SilverlightApplication>
    <SupportedCultures>
    </SupportedCultures>
    <XapOutputs>true</XapOutputs>
    <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
    <XapFilename>MedeTraxAlert_Phase2_$(Configuration)_$(Platform).xap</XapFilename>
    <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
    <SilverlightAppEntry>MedeTraxAlert_Phase2.App</SilverlightAppEntry>
    <ValidateXaml>true</ValidateXaml>
    <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
    <ExpressionBlendVersion>5.0.40218.0</ExpressionBlendVersion>
    <TargetFrameworkProfile />
    <DefaultLanguage>en-US</DefaultLanguage>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>Bin\x86\Debug</OutputPath>
    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>Bin\x86\Release</OutputPath>
    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget />
    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>Bin\ARM\Debug</OutputPath>
    <DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>Bin\ARM\Release</OutputPath>
    <DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget />
    <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="App.xaml.cs">
      <DependentUpon>App.xaml</DependentUpon>
    </Compile>
    <Compile Include="Common\CommonVariables.cs" />
    <Compile Include="Converters\AVPUResponseConverter.cs" />
    <Compile Include="Common\NeuroResponseConverter.cs" />
    <Compile Include="Converters\AlertListTextForegroundConverter.cs" />
    <Compile Include="Converters\AVPUResponseConvertor.cs" />
    <Compile Include="Converters\BooleanToColSpanConverter.cs" />
    <Compile Include="Converters\BooleanToVisibilityConverter.cs" />
    <Compile Include="Converters\ConcernConvertor.cs" />
    <Compile Include="Converters\ConsciousConvertor.cs" />
    <Compile Include="Converters\OxygenConvertor.cs" />
    <Compile Include="Converters\PupilSizeConvertor.cs" />
    <Compile Include="Converters\RespirationDistressConvertor.cs" />
    <Compile Include="Converters\LimbMovementConvertor.cs" />
    <Compile Include="Converters\GCSBestMotorResponseConvertor.cs" />
    <Compile Include="Converters\GCSBestVerbalResponseConvertor.cs" />
    <Compile Include="Converters\GCSEyesOpenResponseConvertor.cs" />
    <Compile Include="LocalizedStrings.cs" />
    <Compile Include="MainPage.xaml.cs">
      <DependentUpon>MainPage.xaml</DependentUpon>
    </Compile>
    <Compile Include="Models\AlertModel.cs" />
    <Compile Include="Models\AuthenticateUserModel.cs" />
    <Compile Include="Models\AcknowledgeModel.cs" />
    <Compile Include="Models\HistoryModel.cs" />
    <Compile Include="Models\HistoryRequestModel.cs" />
    <Compile Include="Models\UidAndUrlModel.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Resources\AppResources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>AppResources.resx</DependentUpon>
    </Compile>
    <Compile Include="UI\AlertsPage.xaml.cs">
      <DependentUpon>AlertsPage.xaml</DependentUpon>
    </Compile>
    <Compile Include="UI\AuthorisationPage.xaml.cs">
      <DependentUpon>AuthorisationPage.xaml</DependentUpon>
    </Compile>
    <Compile Include="Converters\CustomDateTimeAxis.cs" />
    <Compile Include="UI\HistoryDetailsPage.xaml.cs">
      <DependentUpon>HistoryDetailsPage.xaml</DependentUpon>
    </Compile>
    <Compile Include="UI\MessageDetailsPage.xaml.cs">
      <DependentUpon>MessageDetailsPage.xaml</DependentUpon>
    </Compile>
    <Compile Include="UI\RegistrationLoginPage.xaml.cs">
      <DependentUpon>RegistrationLoginPage.xaml</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="App.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </ApplicationDefinition>
    <Page Include="MainPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\AlertsPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\AuthorisationPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\HistoryDetailsPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\MessageDetailsPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
    <Page Include="UI\RegistrationLoginPage.xaml">
      <SubType>Designer</SubType>
      <Generator>MSBuild:Compile</Generator>
    </Page>
  </ItemGroup>
  <ItemGroup>
    <None Include="Fonts\SIXTY.TTF" />
    <AppxManifest Include="Package.appxmanifest">
      <SubType>Designer</SubType>
    </AppxManifest>
    <None Include="project.json" />
    <None Include="Properties\AppManifest.xml" />
    <None Include="Properties\WMAppManifest.xml">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Assets\alarm.mp3" />
    <Content Include="Assets\AlignmentGrid.png" />
    <Content Include="Assets\ApplicationIcon.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\BadgeLogo.png" />
    <Content Include="Assets\Logo.png" />
    <Content Include="Assets\SplashScreen.png" />
    <Content Include="Assets\SquareTile150x150.png" />
    <Content Include="Assets\SquareTile71x71.png" />
    <Content Include="Assets\StoreLogo.png" />
    <Content Include="Assets\Tiles\FlipCycleTileLarge.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\Tiles\FlipCycleTileMedium.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\Tiles\FlipCycleTileSmall.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\Tiles\IconicTileMediumLarge.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\Tiles\IconicTileSmall.png">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="Assets\DrApp_AppIcon.png" />
    <Content Include="Assets\WideLogo.png" />
    <Content Include="Images\alarmIcon.png" />
    <Content Include="Images\BG_1080.png" />
    <Content Include="Images\ExclamationMark.png" />
    <Content Include="ReadMe.Coding4Fun.Toolkit.txt" />
    <Content Include="README_FIRST.txt" />
    <Content Include="Toolkit.Content\ApplicationBar.Add.png" />
    <Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
    <Content Include="Toolkit.Content\ApplicationBar.Check.png" />
    <Content Include="Toolkit.Content\ApplicationBar.Delete.png" />
    <Content Include="Toolkit.Content\ApplicationBar.Select.png" />
    <Content Include="Properties\default.rd.xml" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\AppResources.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>

  <ItemGroup>
    <BlendEmbeddedFont Include="Fonts\segoeuil.ttf">
      <IsSystemFont>True</IsSystemFont>
      <All>True</All>
      <AutoFill>True</AutoFill>
    </BlendEmbeddedFont>
    <BlendEmbeddedFont Include="Fonts\seguili.ttf">
      <IsSystemFont>True</IsSystemFont>
      <All>True</All>
      <AutoFill>True</AutoFill>
    </BlendEmbeddedFont>
  </ItemGroup>
  <ItemGroup>
    <WCFMetadata Include="Service References\" />
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="false"/>

  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="true" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
  <ProjectExtensions />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\Expression\Blend\WindowsPhone\v8.0\Microsoft.Expression.Blend.WindowsPhone.targets" />
    <Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
    <Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
    <Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.10\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
  </Target>
</Project>

我做错了什么?

【问题讨论】:

  • 请尝试在控制面板中修复您的Windows 10 SDK和VS2015 Community Update2,此异常表示目标平台版本设置不正确。

标签: c# windows-8 visual-studio-2015 win-universal-app windows-10-universal


【解决方案1】:

查看您在上面粘贴的 .csproj 示例中的一些条目,您似乎正在尝试将 Windows Phone 8.0 或 Windows Phone 8.1 应用程序迁移到 UWP。一切都没有被正确迁移,因此导致 Visual Studio 项目系统(例如,标签)出错。

您是否遵循了这篇 MSDN 文章中的所有步骤? https://msdn.microsoft.com/en-us/library/mt148501.aspx#MigrateCSharp

我发现最简单的迁移方法是将一个空白的新 UWP 项目添加到解决方案中,然后复制 C#/XAML 文件、其他资产等。或者,创建一个空白 UWP 应用程序,然后比较.csproj 与您拥有的那个 - 差异应该立即弹出。

【讨论】:

    【解决方案2】:

    我可能也遇到了与平台版本和 SDK 工具有关的相同问题。 请尝试从此页面下载独立 SDK:

    https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

    重新安装后,问题就会消失。

    【讨论】:

      【解决方案3】:

      碰到这里.. 当我安装 Visual Studio 2015 社区时,我似乎遇到了同样的问题,其中包含 ISO 映像的更新 3 以及独立的 14393.33 sdk。

      我有两台机器,安装了同一套开发软件。

      我在一台机器上遇到上述问题,而在另一台机器上却没有。

      我怀疑这是网络问题。

      我为什么这么说?因为 Windows SDK 在通过我面临此目标平台版本问题的同一网络安装时也遇到问题。 然后我通过切换到现有网络上的 VPN 并正确安装了 SDK 来克服 SDK 安装问题。 但不幸的是,我无法通过 VPN 继续安装 VS。

      现在我在第二台机器上安装了相同的软件,但这次我使用的是正确安装的办公室网络和 Visual Studio,没有报告与 targetPlatformVersion 相关的问题。

      现在,在面临问题的同一台机器上,我可以确认 Visual Studio 15 preview 4 没有报告相同的问题。

      【讨论】:

        猜你喜欢
        • 2016-10-02
        • 1970-01-01
        • 1970-01-01
        • 2016-12-04
        • 1970-01-01
        • 1970-01-01
        • 2023-03-30
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多