简体   繁体   English

Devops:错误 CS0234:命名空间“Windows”中不存在类型或命名空间名称“ApplicationModel”

[英]Devops: Error CS0234: The type or namespace name 'ApplicationModel' does not exist in the namespace 'Windows'

I am trying to set up a build pipeline for the Windows Universal Sample Application File Access Project .我正在尝试为 Windows 通用示例应用程序文件访问项目设置构建管道。

The pipeline is using the Azure Pipelines Hosted VS2017 Image管道使用 Azure Pipelines Hosted VS2017 Image

The solution builds when I run it in VS locally.当我在本地 VS 中运行它时,该解决方案就会构建。

Package.appxmanifest contains Package.appxmanifest 包含

<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10586.0" MaxVersionTested="10.0.17763.0" />

When the pipeline tries to build the following error appears in the build task log.当管道尝试构建时,构建任务日志中会出现以下错误。

Error CS0234: The type or namespace name 'ApplicationModel' 
does not exist in the namespace 'Windows' 
(are you missing an assembly reference?)

The YAML is YAML 是

resources:
- repo: self
queue:
  name: Hosted VS2017
  demands: 
  - msbuild
  - visualstudio

steps:
- task: NuGetCommand@2
  displayName: 'NuGet restore'


- task: VSBuild@1
  displayName: 'Build solution **\*.sln'

The project looks like this on my machine该项目在我的机器上看起来像这样

项目参考

Where在哪里一个参考

Microsoft.UI.Xaml.Markup

And it runs correctly.它运行正确。

I notice the log for the Nuget Restore task has no errors and does report我注意到 Nuget Restore 任务的日志没有错误并且确实报告了

2018-12-16T01:27:31.8700773Z Checking compatibility for Microsoft.NETCore.Targets.UniversalWindowsPlatform 5.0.0 with UAP,Version=v10.0 (win10-x86-aot).
2018-12-16T01:27:31.8700831Z Checking compatibility for Microsoft.NETCore.Platforms 1.0.0 with UAP,Version=v10.0 (win10-x86-aot).
2018-12-16T01:27:31.8700878Z All packages and projects are compatible with UAP,Version=v10.0 (win10-x86-aot).

[Update] [更新]

Looking at the location on my machine of the SDK查看SDK在我机器上的位置

C:\Program Files (x86)\Windows Kits\10\References\10.0.17763.0\Windows.AI.MachineLearning.MachineLearningContract\1.0.0.0

I wonder how Nuget is meant to know about that.我想知道 Nuget 是如何知道这一点的。 Indeed I wonder why it has something about MachineLearning in the path.事实上,我想知道为什么它在路径中包含机器学习。

[Update] [更新]

I changed versions to 17134 (RS4/1803) instead of 17763 (RS5/1809) as suggested by Stefan Wick MSFT我按照 Stefan Wick MSFT 的建议将版本更改为 17134 (RS4/1803) 而不是 17763 (RS5/1809)

The errors changed to错误更改为

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft
.AppXPackage.Targets(3218,5): Error APPX0101: A signing key is required in 
order to package this project. Please specify a PackageCertificateKeyFile or 
PackageCertificateThumbprint value in the project file.
Process 'msbuild.exe' exited with code '1'.
SharedContent\Templates\UWPSDKSampleCPP\ARM\Debug\UWPSDKSampleCPP\AppxManifest.xml(0,0):

Error APPX0501: Validation error. error C00CE169: App manifest validation 
error: The app manifest must be valid as per schema: Line 10, Column 13, 
Reason: 'Microsoft.SDKSamples.$safeprojectname$.CPP' violates pattern 
constraint of '[-.A-Za-z0-9]+'. The attribute 'Name' with value 
'Microsoft.SDKSamples.$safeprojectname$.CPP' failed to parse.
Process 'msbuild.exe' exited with code '1'.
SharedContent\Templates\UWPSDKSampleCS\bin\ARM\Debug\AppxManifest.xml(0,0): 
Error APPX0501: Validation error. error C00CE169: App manifest validation error: 
The app manifest must be valid as per schema: Line 10, Column 13, Reason: 'Microsoft.SDKSamples.$safeprojectname$.CS' violates pattern constraint of '[-.A-Za-z0-9]+'. 
The attribute 'Name' with value 'Microsoft.SDKSamples.$safeprojectname$.CS' failed to parse.
Process 'msbuild.exe' exited with code '1'

The error is due to the fact that your app is targeting the 1809 SDK (v17763), which has not been rolled out on the build agents yet, due to some issues .该错误是由于您的应用程序针对 1809 SDK (v17763),由于某些问题,该 SDK 尚未在构建代理上推出。

Until it has been rolled out on the agents, you have two options to get unblocked:在它在代理上推出之前,您有两种选择可以解除封锁:

  1. Target the 1803 SDK (v17134) if you don't actually need any APIs from the 1809 SDK - or如果您实际上不需要来自 1809 SDK 的任何 API,则以 1803 SDK (v17134) 为目标 - 或者
  2. Use this script to explicitely install the 17763 SDK dependency使用此脚本显式安装 17763 SDK 依赖项

I will update the answer once there is an update regarding the SDK rollout to build agents.一旦有关于构建代理的 SDK 部署的更新,我将更新答案。

Stefan Wick在评论中给出了答案。

暂无
暂无

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

相关问题 是什么导致“名称空间中不存在类型或名称空间名称&#39;UI&#39;”错误? - What is causing “The type or namespace name 'UI' does not exist in the namespace” error? 错误UWP目标中命名空间“Windows”中不存在类型或命名空间名称“Networking”,如何在多目标项目中修复project.json - Error The type or namespace name 'Networking' does not exist in the namespace 'Windows' in UWP target, how to fix project.json in multi-target project 命名空间“Windows”中不存在类型或命名空间名称“存储”(您是否缺少任何程序集引用?) - The Type or namespace name 'Storage' does not exist in the namespace 'Windows'(are you missing any assembly references ?) 命名空间“Microsoft”中不存在类型或命名空间名称“Azure” - The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' 名称空间中不存在名称 - Name does not exist in the namespace 命名空间“PdfSharp.Xamarin.Forms”中不存在类型或命名空间名称“UWP” - The type or namespace name 'UWP' does not exist in the namespace 'PdfSharp.Xamarin.Forms' Windows.ApplicationModel不存在,为什么? - Windows.ApplicationModel does not exist, why? 名称空间“using:Y”中不存在名称“X” - The name "X" does not exist in the namespace "using:Y" 名称“Customer 在命名空间中不存在” using:.... UWP - The name "Customer does not exist in the namespace "using:...." UWP Windows.services中不存在命名空间`store` - Namespace `store` does not exist in windows.services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM