简体   繁体   English

nuget 命令 Source Add 开始无缘无故地失败,并警告要求提供唯一的来源

[英]nuget command Source Add started to fail out of nowhere with a warning asking for a unique source

I have an c# wpf application and an additional installer project to create an installer of the application.我有一个 c# wpf 应用程序和一个额外的安装程序项目来创建应用程序的安装程序。 Among many other files, the installer project has a installer.cmd file (I took over it from someone else) and a Product.wxs file.在许多其他文件中,安装程序项目有一个 installer.cmd 文件(我从别人那里接手的)和一个 Product.wxs 文件。 I was able to create an installer by running msbuild tools\installer.cmd /P:Library.net461 /P:Platform=x64 command on the developper comand prompt.我能够通过在 developper 命令提示符下运行msbuild tools\installer.cmd /P:Library.net461 /P:Platform=x64命令来创建安装程序。
I was trying to create a desktop shortcut in all user's desktops and was playing with *.wxs file for that.我试图在所有用户的桌面上创建一个桌面快捷方式,并为此使用 *.wxs 文件。 I know you guys will roast me because of the following sentence but I don't know what else can I say.我知道你们会因为下面这句话而烤我,但我不知道我还能说什么。 Something I did break something and somehow the msbuild starts to give error.我确实破坏了一些东西,不知何故msbuild开始出错。 I cannot say what I did because I tried many different things.. I went back to original project but it didn't help.我不能说我做了什么,因为我尝试了很多不同的东西。我回到了原来的项目,但没有帮助。 So what is done is done.所以已经完成了。 I will talk about the error now.我现在将讨论错误。
The error itself doesn't tell much:错误本身并不能说明什么:

C:\workspace\QToolInstaller\tools\installer.cmd(117,5): error MSB3073: The command "nuget Source Add -Name PkgSrc_638107674121812897 -Source C:\workspace\QToolInstaller\exports" exited with code 1.

I checked online to understand this error code but there wasn't much.我在线检查以了解此错误代码,但并不多。 However there is another line just before this erorr line:但是,在此错误行之前还有另一行:

The source specified has already been added to the list of available package sources. Provide a unique source.

Well, this wasn't in usual warning color or marked as a warning.好吧,这不是通常的警告颜色或标记为警告。 But I think it is worth to investigate.但我认为值得研究。
So the "source" mentioned here is PkgSrc_638107674121812897 .所以这里说的“来源”是PkgSrc_638107674121812897 I scanned the installer.cmd to see where is this coming form and saw that this file is named by using time ticks as:我扫描了 installer.cmd 以查看即将到来的表格在哪里,并看到该文件使用时间标记命名为:

<LocalSource>PkgSrc_$([System.DateTime]::UtcNow.Ticks)</LocalSource>

Although I ran the msbuild command multiple times, the name of the source is always different.虽然我多次运行msbuild命令,但源的名称总是不同的。 I ran the command in diagnostic mode by using -verbosity:diag option.我使用-verbosity:diag选项在诊断模式下运行命令。 And I checked the file name among all the logs.我检查了所有日志中的文件名。 There is no match.没有匹配项。 I tried to change the name to something ridicolous that cannot be listed anywhere but got the same error.我试图将名称更改为无法在任何地方列出但出现相同错误的可笑名称。 Removed alll the files, created them again, restarted the PC etc. Nothing have changed.删除所有文件,重新创建它们,重新启动 PC 等。没有任何改变。 This name is really unique and but still I am getting this message.这个名字真的很独特,但我仍然收到这条消息。 I wish I had logs form previous successfull runs.我希望我有以前成功运行的日志。 I cannot tell if this is the cause of the failure or not.我不知道这是否是失败的原因。 Does any of these ring any bell fellas?这些中的任何一个都会响铃吗?

It is solved.它被解决了。 Luckily a colleague of mine have faced with this before.幸运的是,我的一位同事以前遇到过这种情况。 I hope no one will have to deal with this problem again.我希望没有人会再次处理这个问题。
So apparently there is a bug(?).所以显然有一个错误(?)。 Altought that name is unique it thinks the opposite. Altought 这个名字是独一无二的,它认为相反。 When I do list the sources with thw followng command当我使用 thw followng 命令列出来源时

nuget source

among the one that should be there, there is one extra line as PkgSrc_638107643440982987 .在应该存在的那一行中,有一行是PkgSrc_638107643440982987 Although my installer.cmd suppose to remove the source every time after it is done, it didn't for once.尽管我的installer.cmd假设每次完成后都删除源,但一次都没有。 And although the new source is named differently, it doesn't care and gives that non-warning, non-error message followed by a meaningless error code 1 message.尽管新源的名称不同,但它并不关心并给出非警告、非错误消息,后跟无意义的错误代码 1 消息。 How to solve it?如何解决?
We tried to remove the source by command prompt like this:我们尝试通过命令提示符删除源代码,如下所示:

nuget source delete -Name PkgSrc_638107643440982987

But it is not deleted.但它并没有被删除。 So we went to the Visual Studio->Tools->NuGet Package Manager->Package Manager Settings->Package Sources.所以我们去了 Visual Studio->Tools->NuGet Package Manager->Package Manager Settings->Package Sources。 Found the guilty source and remove it.找到有罪的来源并将其删除。 And then it is resolved.然后就解决了。

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

相关问题 如何在 msbuild 15.0 命令行中指定私有 nuget 包源? - How to specify private nuget package source in msbuild 15.0 command line? 无法弄清楚如何将源代码包含到生成的 nuget package 中 - Can't figure out how to include the source code into the nuget package that gets generated 让 Jenkins 了解自定义 NuGet 包源 - Make Jenkins aware of custom NuGet Package Source NuGet Package Restore找不到包,没有Source - NuGet Package Restore cannot find package, has no Source 随 nuget package 一起安装的源生成器可配置设置文件 - Source generator configurable settings file installed with nuget package msbuild,支持源代码外生成 - msbuild, support for out-of-source builds MSBuild发布停止无处工作 - MSBuild publish stopped working out of nowhere 401 Jenkins 和 TFS 突然未经授权 - 401 Unauthorized out of nowhere with Jenkins and TFS 如何正确打包生成源代码作为构建一部分的 Nuget 分布式自定义工具 - How to properly package a Nuget distributed custom tool that generates source code as part of the build 用vs2008编译的源产生的二进制文件不同于在命令行中csc直接编译的同一源 - A source compiled with vs2008 produce a binary that is different from the same source compiled directly by csc at command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM