英文:
NuGet.Config is not valid XML. Path running DotNetCoreCli
问题
以下是代码部分的翻译:
The following task fails in my Azure Devops pipeline.
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
with errors like
"D:\a\s\MySnap.Main.sln" (Restore target) (1) ->
"D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj" (_GenerateRestoreGraphProjectEntry target) (6:6) ->
C:\Program Files\dotnet\sdk.0.200\NuGet.targets(679,5): error : NuGet.Config is not valid XML. Path: 'D:\a\Nuget\tempNuGet_6479.config'. [D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
C:\Program Files\dotnet\sdk.0.200\NuGet.targets(679,5): error : The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 8, position 46. [D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
WinFormsCoreMain\NuGet.Config exists
The pipeline so far is
trigger:
- master
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Major: '2'
Minor: '0'
Patch: '0'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.3.0'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
I upgraded to using DotNetCoreCli@2 after my old pipeline recently [stopped working][1].
I also upgraded my projects to being either .net7 or framework4.8 figuring the only way out is forward.
[Update]
Investigating advice at [help][2].
> The issue can be fixed using the new NugetAuthenticate task.
[![Nuget authenticate][3]][3]
So how do I format the service connection credentials?
I guess I use information from within my Nuget Package Manager -> Packages Sources ?
I tried adding a name
[![unexpected property][4]][4]
Now I am checking the [help][5]
I have updated the steps as follows but there is no improvement
steps:
- task: NuGetAuthenticate@1
inputs:
forceReinstallCredentialProvider: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.2'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
[Update]
NuGet.Config looks like this ( with obfuscations)
[![Nuget.Config][6]][6]
Checking [DevExpress advice][7].
[Update[
I tried commenting out the "SBDCommonFeed@Local" packageSource and the restore task was able to run.
SBDCommonFeed is the name of a feed in my artifacts.
Why do I need to comment it out to avoid this particular error?
[1]: https://stackoverflow.com/questions/75597699/error-nu5049-the-pack-command-for-sdk-style-projects-is-not-supported
[2]: https://%20https://developercommunity.visualstudio.com/AzureDevOps?port=1025&fsid=e8b7eeed-2c5b-4b1f-aef3-95e5979c08b6&viewtype=all&q=NuGet.Config%20is%20not%20valid%20XML.%20Path%20running%20DotNetCoreCli
[3]: https://i.stack.imgur.com/kBrcR.png
[4]: https://i.stack.imgur.com/CTKLf.png
[5]: https://learn.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#nuget-service-connection
[6]: https://i.stack.imgur.com/tzOV0.png
[7]: https://docs.devexpress.com/GeneralInformation/400604/installation/install-devexpress-controls-using-nuget-packages/integrate-nuget-to-popular-continuous-integration-systems
请注意,我已经忽略了代码部分并提供了非代码内容的翻译。
英文:
The following task fails in my Azure Devops pipeline.
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
with errors like
"D:\a\s\MySnap.Main.sln" (Restore target) (1) ->
"D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj" (_GenerateRestoreGraphProjectEntry target) (6:6) ->
C:\Program Files\dotnet\sdk.0.200\NuGet.targets(679,5): error : NuGet.Config is not valid XML. Path: 'D:\a\Nuget\tempNuGet_6479.config'. [D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
C:\Program Files\dotnet\sdk.0.200\NuGet.targets(679,5): error : The '@' character, hexadecimal value 0x40, cannot be included in a name. Line 8, position 46. [D:\a\s\SBD.Core.MySnap.UI\SBD.Core.MySnap.UI.csproj]
WinFormsCoreMain\NuGet.Config exists
The pipeline so far is
trigger:
- master
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
Major: '2'
Minor: '0'
Patch: '0'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=4.3.0'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
I upgraded to using DotNetCoreCli@2 after my old pipeline recently stopped working.
I also upgraded my projects to being either .net7 or framework4.8 figuring the only way out is forward.
[Update]
Investigating advice at help.
> The issue can be fixed using the new NugetAuthenticate task.
So how do I format the service connection credentials?
I guess I use information from within my Nuget Package Manager -> Packages Sources ?
I tried adding a name
Now I am checking the help
I have updated the steps as follows but there is no improvement
steps:
- task: NuGetAuthenticate@1
inputs:
forceReinstallCredentialProvider: true
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.2'
checkLatest: false
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: 'WinFormsCoreMain\NuGet.Config'
[Update]
NuGet.Config looks like this ( with obfuscations)
Checking DevExpress advice.
[Update[
I tried commenting out the "SBDCommonFeed@Local" packageSource and the restore task was able to run.
SBDCommonFeed is the name of a feed in my artifacts.
Why do I need to comment it out to avoid this particular error?
答案1
得分: 1
根据构建错误信息:
NuGet.targets(679,5): error : NuGet.Config 不是有效的 XML。路径:'D:\a\1\Nuget\tempNuGet_6479.config'
NuGet.targets(679,5): error : 字符'@',十六进制值0x40,不能包含在名称中
看起来,一些特殊字符 https://github.com/NuGet/Home/issues/7948(包括“@”字符)不允许出现在静态和动态生成的 NuGet.config 文件的“packageSources”名称中。
因此,如果允许修改 YAML/NuGet.config 文件,请尽量避免在包源名称中使用“@”字符。
英文:
According to the failed build error message:
> NuGet.targets(679,5): error : NuGet.Config is not valid XML. Path: 'D:\a\1\Nuget\tempNuGet_6479.config'
> NuGet.targets(679,5): error : The '@' character, hexadecimal value 0x40, cannot be included in a name
It appears, that some special characters https://github.com/NuGet/Home/issues/7948 (including the "@" one) are not allowed within a name of the "packageSources" of a static and dynamically generated NuGet.config files.
So, if you are allowed to modify the YAML/NuGet.config file(s), try to avoid the "@" char in the package source name(s).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论