CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
228 stars 89 forks source link

gitversion.json Not Found #432

Closed Rivendell2898 closed 1 year ago

Rivendell2898 commented 1 year ago

Hi! I'm new in VS C#, I want to try to build the project myself, but I found the following error FileNotFoundException: 未能找到文件“D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client\Localization\obj\gitversion.json” I could not find this file gitversion.json in the source code neither using git clone nor 'download ZIP' How can I get or generate this file? Thanks a lot!

SadPencil commented 1 year ago

Restart visual studio, clean up and rebuild the solution.

Rivendell2898 commented 1 year ago

Restart visual studio, clean up and rebuild the solution.

Thanks for reply! but this did not work for me. I even move the project to another disk. In fact, there are 5 errors: FileNotFoundException: 未能找到文件“G:\xna-cncnet-client\Localization\obj\gitversion.json” FileNotFoundException: 未能找到文件“G:\xna-cncnet-client\ClientCore\obj\gitversion.json” FileNotFoundException: 未能找到文件“G:\xna-cncnet-client\ClientGUI\obj\gitversion.json” FileNotFoundException: 未能找到文件“G:\xna-cncnet-client\DTAConfig\obj\gitversion.json” FileNotFoundException: 未能找到文件“G:\xna-cncnet-client\DXMainClient\obj\gitversion.json” I cleaned and bulid the project, but gitversion.json still not found ( ´•︵•` )

SadPencil commented 1 year ago

I reproduced your problem by removing the .git folder. Please make sure the project is git cloned. When copying the source codes, you must preserve the .git folder. Guarantee that git log command is valid under the project folder.

SadPencil commented 1 year ago

65717e596c4a60fc0424f8d9f73c416fda37d8b6

@devo1929 We need to add a tip in Development requirements to claim that the project can only be compiled if the project is managed by Git instead of 'Download ZIP'.

devo1929 commented 1 year ago

Yea, that or either allow the build step to skip the gitversion tool usage if it's not from a clone.

Rivendell2898 commented 1 year ago

I reproduced your problem by removing the .git folder. Please make sure the project is git cloned. When copying the source codes, you must preserve the .git folder. Guarantee that git log command is valid under the project folder.

I tried git clone command but failed. I compiled the project with the right mouse button in VS2022 interface. Should I use command line to compile the project? Or could the gitversion.json be provided or skipped? Thanks a lot!

SadPencil commented 1 year ago

I reproduced your problem by removing the .git folder. Please make sure the project is git cloned. When copying the source codes, you must preserve the .git folder. Guarantee that git log command is valid under the project folder.

I tried git clone command but failed. I compiled the project with the right mouse button in VS2022 interface. Should I use command line to compile the project? Or could the gitversion.json be provided or skipped? Thanks a lot!

You must get the source code via git clone. China has blocked GitHub and it is your job to bypass the interference.

Also please learn how to properly describe a problem. Avoid imprecise expressions such as “failed” and “with the right mouse button”.

Rivendell2898 commented 1 year ago

You must get the source code via git clone. China has blocked GitHub and it is your job to bypass the interference.

Also please learn how to properly describe a problem. Avoid imprecise expressions such as “failed” and “with the right mouse button”.

Sorry about that. I tried to change VS2022 to English to discribe precisely. In fact, I found git clone is not blocked in VS2022 so far. I used the latest version and opened DXClient.sln in VS2022. Then, I chose Debug->Start Debugging and used AresUniversalGLDebug to debug the project. It was automatically rebuilt and showed the same error. After that, I tried Build->Clean Solution and Build->Build Solution and reulted in the same error, ie: FileNotFoundException: Could not find file 'D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client\Localization\obj\gitversion.json'.

Rivendell2898 commented 1 year ago

By the way, the .git folder is also included. The same error also found in ClientCore, ClientGUI, DTAConfig and DXMainClient folder as shown above 3 days ago. One of the full error message is shown below, the others are the same.

Severity Code Description Project File Line Suppression State Error FileNotFoundException: Could not find file 'D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client\Localization\obj\gitversion.json'. at System.IO.Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at GitVersion.FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\FileSystem.cs:line 43 at GitVersion.OutputVariables.VersionVariables.FromFileInternal(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Model\VersionVariables.cs:line 171 at Polly.Policy`1.<>c__DisplayClass11_0.b0(Context , CancellationToken ) at Polly.Retry.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider) at Polly.Retry.RetryPolicy1.Implementation(Func3 action, Context context, CancellationToken cancellationToken) at Polly.Policy1.Execute(Func3 action, Context context, CancellationToken cancellationToken) at GitVersion.OutputVariables.VersionVariables.FromFile(String filePath, IFileSystem fileSystem) at GitVersion.MsBuild.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTaskExecutor.cs:line 24 at GitVersion.MsBuild.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action1 action) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTasks.cs:line 30 Localization C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets 19

SadPencil commented 1 year ago

By the way, the .git folder is also included. The same error also found in ClientCore, ClientGUI, DTAConfig and DXMainClient folder as shown above 3 days ago.

One of the full error message is shown below, the others are the same.

Severity Code Description Project File Line Suppression State

Error FileNotFoundException: Could not find file 'D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client\Localization\obj\gitversion.json'.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)

at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)

at GitVersion.FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\FileSystem.cs:line 43

at GitVersion.OutputVariables.VersionVariables.FromFileInternal(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Model\VersionVariables.cs:line 171

at Polly.Policy`1.<>c__DisplayClass11_0.b_0(Context , CancellationToken _)

at Polly.Retry.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permittedRetryCount, IEnumerable1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)

at Polly.Retry.RetryPolicy1.Implementation(Func3 action, Context context, CancellationToken cancellationToken)

at Polly.Policy1.Execute(Func3 action, Context context, CancellationToken cancellationToken)

at GitVersion.OutputVariables.VersionVariables.FromFile(String filePath, IFileSystem fileSystem)

at GitVersion.MsBuild.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTaskExecutor.cs:line 24

at GitVersion.MsBuild.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTasks.cs:line 30

Localization C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets 19

This is more clear. Please open a cmd in the project folder and run the following commands. Paste the output here.

git status

echo %USERPROFILE%
Rivendell2898 commented 1 year ago

This is more clear. Please open a cmd in the project folder and run the following commands. Paste the output here.

git status

echo %USERPROFILE%

OK, I tried Open in Command Prompt and run the commands, the output are as follows:

D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client>git status On branch develop Your branch is up to date with 'origin/develop'. nothing to commit, working tree clean D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client>echo %USERPROFILE% C:\Users\lcx

SadPencil commented 1 year ago

This is weird. @devo1929 Any ideas?

SadPencil commented 1 year ago

@Rivendell2898 Try moving the project into a folder whose path is without space and see whether it fixes. https://github.com/GitTools/GitVersion/issues/2540

Rans4ckeR commented 1 year ago

@Rivendell2898 just remove the NuGet package GitVersion.MsBuild from the solution and put it back before you commit something.

@devo1929 what problem do you see if we just move from GitVersion.MsBuild to GitVersion actions?

e.g.: cncnet-client-updater dta-mg-client-launcher

Rivendell2898 commented 1 year ago

@Rivendell2898 Try moving the project into a folder whose path is without space and see whether it fixes. GitTools/GitVersion#2540

I tired before, moving the folder to G:/, the same error occured. It seems not the space or Chinese characters that lead the problem.

Rivendell2898 commented 1 year ago

GitVersion

Thanks, but I did not find the file or folder GitVersion.MsBuild in the projest. Do you mean some VS2022 packages?

SadPencil commented 1 year ago

GitVersion Thanks

"NuGet package"

Rivendell2898 commented 1 year ago

I removed all of the GitVersion.MsBuild packages and it worked! Thanks a lot for your kind reply!

SadPencil commented 1 year ago

This is just a workaround. We need to investgate why GitVersion won't work as expected. Can you re-open the issue?

Rivendell2898 commented 1 year ago

This is just a workaround. We need to investgate why GitVersion won't work as expected. Can you re-open the issue?

Ok, done.

devo1929 commented 1 year ago

@Rivendell2898 can you provide the full log when the build fails? There should be a point in the build where it runs the gitversion.dll from the packages folder. This is what generates the gitversion.json file. So, if that JSON file doesn't exist, it means gitversion.dll might have been unsuccessful.

The command will look similar to:

RunGitVersion:
dotnet --roll-forward Major "<somepath>\packages\gitversion.msbuild\5.11.1\tools\netcoreapp3.1\gitversion.dll" .........
Rivendell2898 commented 1 year ago

I run the command in cmd and the result are as follows

{ "Major": 2, "Minor": 8, "Patch": 0, "PreReleaseTag": "beta.183", "PreReleaseTagWithDash": "-beta.183", "PreReleaseLabel": "beta", "PreReleaseLabelWithDash": "-beta", "PreReleaseNumber": 183, "WeightedPreReleaseNumber": 183, "BuildMetaData": null, "BuildMetaDataPadded": "", "FullBuildMetaData": "Branch.develop.Sha.890a83c2e5ff538a5c848ef2e7c9bdfec89b6e6b", "MajorMinorPatch": "2.8.0", "SemVer": "2.8.0-beta.183", "LegacySemVer": "2.8.0-beta183", "LegacySemVerPadded": "2.8.0-beta0183", "AssemblySemVer": "2.8.0.0", "AssemblySemFileVer": "2.8.0.0", "FullSemVer": "2.8.0-beta.183", "InformationalVersion": "2.8.0-beta.183+Branch.develop.Sha.890a83c2e5ff538a5c848ef2e7c9bdfec89b6e6b", "BranchName": "develop", "EscapedBranchName": "develop", "Sha": "890a83c2e5ff538a5c848ef2e7c9bdfec89b6e6b", "ShortSha": "890a83c", "NuGetVersionV2": "2.8.0-beta0183", "NuGetVersion": "2.8.0-beta0183", "NuGetPreReleaseTagV2": "beta0183", "NuGetPreReleaseTag": "beta0183", "VersionSourceSha": "f6b8b39402016a3f742b1be97d12d883c142db6e", "CommitsSinceVersionSource": 182, "CommitsSinceVersionSourcePadded": "0182", "UncommittedChanges": 121, "CommitDate": "2023-01-20" }

devo1929 commented 1 year ago

That's fine that it runs in cmd, but it needs to run properly in your VS build. When you get the build failure in VS, do you see any references to this command failing?

SadPencil commented 1 year ago

@devo1929 In his previous reply, this is weird at GitVersion.FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\FileSystem.cs:line 43, where D:\a\GitVersion should be an invalid path.

devo1929 commented 1 year ago

You don't know that D:\a is an invalid path on their machine. That's a complete stack trace and that line is right in the middle, suggesting that it's gotten through that point.

SadPencil commented 1 year ago

You don't know that D:\a is an invalid path on their machine. That's a complete stack trace and that line is right in the middle, suggesting that it's gotten through that point.

He builds the client of which the source code is at D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client. This indicates that D:\a should not be involved during the whole compilation process.

Metadorius commented 1 year ago

You don't know that D:\a is an invalid path on their machine. That's a complete stack trace and that line is right in the middle, suggesting that it's gotten through that point.

He build the client of which the source code is at D:\Program Data\VisualStudio\Source\Repos\xna-cncnet-client. This indicates that D:\a should not be involved during the whole compilation process.

I don't think this is related? This is a path to the source file from which the GitVersion.dll was built and line in it, meaning it has nothing to do with the usage, it just tells where the error is. It seems like GitVersion.dll was built using CI, hence why the path looks like so.

SadPencil commented 1 year ago

@Rivendell2898 I have sent you a zipped xna-cncnet-client folder. Please try compiling on that folder and observe whether the error still exists.

https://pan.baidu.com/s/13kDTsBlHY0Pb4R-UhCd_FQ?pwd=9dfa

Rivendell2898 commented 1 year ago

@Rivendell2898 I have sent you a zipped xna-cncnet-client folder. Please try compiling on that folder and observe whether ……

There are 11 errors, different from all errors above (‧_‧?), including errors like this

Error CS0246 The type or namespace name 'Rampastring' could not be found (are you missing a using directive or an assembly reference?) ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 2 Active Error CS0246 The type or namespace name 'IniFile' could not be found (are you missing a using directive or an assembly reference?) ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 47 Active Error CS0103 The name 'SafePath' does not exist in the current context ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 42 Active Error CS0103 The name 'Logger' does not exist in the current context ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 304 Active Error NETSDK1004 Assets file 'D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Localization C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267 ...

SadPencil commented 1 year ago

@Rivendell2898 I have sent you a zipped xna-cncnet-client folder. Please try compiling on that folder and observe whether

……

There are 11 errors, different from all errors above (‧_‧?), including errors like this

Error CS0246 The type or namespace name 'Rampastring' could not be found (are you missing a using directive or an assembly reference?) ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 2 Active

Error CS0246 The type or namespace name 'IniFile' could not be found (are you missing a using directive or an assembly reference?) ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 47 Active

Error CS0103 The name 'SafePath' does not exist in the current context ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 42 Active

Error CS0103 The name 'Logger' does not exist in the current context ClientCore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\Settings\UserINISettings.cs 304 Active

Error NETSDK1004 Assets file 'D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Localization C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267

...

This indicates that your computer might have issue on downloading NuGet packages. Try the following command in cmd in the project folder to force a downloading.

msbuild xxxxx.sln /t:Restore /p:RestorePackagesConfig=true
Rivendell2898 commented 1 year ago

There is an error, which means there is no target “Restore” in the project.

项目“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”在节点 1 上(Restore 个目标)。 ValidateSolutionConfiguration: 正在生成解决方案配置“AresUniversalGLDebug|Any CPU”。 D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln.metaproj : error MSB4057: 该项目中不存在目标“Restore”。 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] 已完成生成项目“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(Restore 个目标)的操作 - 失败。 生成失败。 “D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(Restore 目标) (1) -> D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln.metaproj : error MSB4057: 该项目中不存在目标“Restore” 。 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] 0 个警告 1 个错误 已用时间 00:00:00.38

SadPencil commented 1 year ago

There is an error, which means there is no target “Restore” in the project.

项目“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”在节点 1 上(Restore 个目标)。

ValidateSolutionConfiguration:

正在生成解决方案配置“AresUniversalGLDebug|Any CPU”。

D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln.metaproj : error MSB4057: 该项目中不存在目标“Restore”。

[D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln]

已完成生成项目“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(Restore 个目标)的操作 - 失败。

生成失败。

“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(Restore 目标) (1) ->

D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln.metaproj : error MSB4057: 该项目中不存在目标“Restore”

。 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln]

0 个警告

1 个错误

已用时间 00:00:00.38

My fault. dotnet restore

Rivendell2898 commented 1 year ago

There is still errors in dotnet restore

D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet restore Determining projects to restore... D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\ClientCore.csproj : error NU1101: Unable to find package Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetd iskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientGUI\ClientGUI.csproj : error NU1101: Unable to find p ackage Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj : error NU1101: Unable to find package Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\Baidu NetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DTAConfig\DTAConfig.csproj : error NU1101: Unable to find p ackage Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\ClientCore.csproj (in 205 ms ). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientGUI\ClientGUI.csproj (in 205 ms). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DTAConfig\DTAConfig.csproj (in 247 ms). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj (in 24 7 ms). 1 of 5 projects are up-to-date for restore.

And after that, I tried to remove /t:Restore and complie the project using msbuild DXClient.sln /p:RestorePackagesConfig=true It succeeded with warnings like this, which probably means the project file "DXMainClient DXMainClient. csproj" is not supported by MSBuild and cannot be generated.

“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(默认目标) (1) -> “D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj.metaproj”(默认目标) (2) -> (Build 目标) -> D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj.metaproj : warning MSB40 78: 项目文件“DXMainClient\DXMainClient.csproj”不受 MSBuild 支持,无法生成。

SadPencil commented 1 year ago

There is still errors in dotnet restore

D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet restore Determining projects to restore... D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\ClientCore.csproj : error NU1101: Unable to find package Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetd iskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientGUI\ClientGUI.csproj : error NU1101: Unable to find p ackage Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj : error NU1101: Unable to find package Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\Baidu NetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DTAConfig\DTAConfig.csproj : error NU1101: Unable to find p ackage Rampastring.XNAUI..Debug. No packages exist with this id in source(s): Local file package source [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln] Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\ClientCore.csproj (in 205 ms ). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientGUI\ClientGUI.csproj (in 205 ms). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DTAConfig\DTAConfig.csproj (in 247 ms). Failed to restore D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj (in 24 7 ms). 1 of 5 projects are up-to-date for restore.

And after that, I tried to remove /t:Restore and complie the project using msbuild DXClient.sln /p:RestorePackagesConfig=true It succeeded with warnings like this, which probably means the project file "DXMainClient DXMainClient. csproj" is not supported by MSBuild and cannot be generated.

“D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXClient.sln”(默认目标) (1) -> “D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj.metaproj”(默认目标) (2) -> (Build 目标) -> D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj.metaproj : warning MSB40 78: 项目文件“DXMainClient\DXMainClient.csproj”不受 MSBuild 支持,无法生成。

Run the following two commands and paste all outputs.

dotnet publish DXMainClient\DXMainClient.csproj --configuration=Release -property:GAME=Ares -property:ENGINE=UniversalGL --framework=net7.0

dotnet nuget list source

This should determine whether NuGet works properly or not.

Rivendell2898 commented 1 year ago

Here are the result, a lot of similar errors. D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet publish DXMainClient\DXMainClient.csproj --configuration=Release -property:GAME=Ares -property:ENGINE=UniversalGL --framework=net7.0

MSBuild version 17.4.1+9a89d02ff for .NET Determining projects to restore... Restored D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj (in 269 ms). Restored D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientCore\ClientCore.csproj (in 269 ms). Restored D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ClientGUI\ClientGUI.csproj (in 269 ms). Restored D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DTAConfig\DTAConfig.csproj (in 285 ms). Restored D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\DXMainClient\DXMainClient.csproj (in 285 ms). C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : FileNotFoundException: Could not find file 'D:\BaiduNetdiskDownload\xna-cncnet-client \xna-cncnet-client\Localization\obj\gitversion.json'. [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Loca lization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, Fil eAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localiza tion.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localizatio n\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO.File.OpenRead(String path) [D:\BaiduNetdiskDownload\xna-cncnet-client \xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\G itVersion.Core\Core\FileSystem.cs:line 43 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.OutputVariables.VersionVariables.FromFileInternal(String filePath, I FileSystem fileSystem) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Model\VersionVariables.cs:line 171 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Locali zation.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.OutputVariables.VersionVariables.<>c__DisplayClass113_0.<FromFile>b_ _0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Policy1.<>cDisplayClass11_0.b0(Context , CancellationToken ) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retry.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permittedRetryCount, IEnum erable1 sleepDurationsEnumerable, Func4 sleepDurationProvider) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retry.RetryPolicy1.Implementation(Func3 action, Context context, Cancel lationToken cancellationToken) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Policy1.Execute(Func3 action, Context context, CancellationToken cancel lationToken) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Policy1.Execute(Func1 action) [D:\BaiduNetdiskDownload\xna-cncnet-clien t\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.Helpers.RetryAction2.Execute(Func`1 operation) in D:\a\GitVersion\G itVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 35 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.OutputVariables.VersionVariables.FromFile(String filePath, IFileSyst em fileSystem) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.c sproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.MsBuild.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\G itVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTaskExecutor.cs:line 24 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.MsBuild.GitVersionTasks.<>cDisplayClass0_0.b0(IGitVe rsionTaskExecutor executor) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTasks.cs:line 13 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Locali zation.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion.MsBuild.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 ac tion) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVersionTasks.cs:line 30 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localizati on.csproj]

And the second command, the first "NuGet official package source" is disabled, while the second enabled. D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet nuget list source

注册的源:

  1. NuGet official package source [已禁用] https://api.nuget.org/v3/index.json
  2. Local file package source [已启用] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\References
SadPencil commented 1 year ago

Finally, this issue can be closed as we have found the reason.

@Rivendell2898 The official package source must be enabled. By default it is enabled.

@Rans4ckeR Do you think we need to prompt developers checking their NuGet package source or assume the official source be enabled?

@Rans4ckeR @devo1929 I think it is fine to preserve the current GitVersion integration as it works as intended.

Rivendell2898 commented 1 year ago

Finally, this issue can be closed as we have found the reason.

@Rivendell2898 The official package source must be enabled. By default it is enabled.

Oh, I closed the NuGet official package source when I remove GitVersion.MsBuild packages. Now I opened official package source, rebuilt the project and found the familiar error again

C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : FileNotFoundExce ption: Could not find file 'D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\obj\gitversion.jso n'. [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft. Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOpt ions options) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft. Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions o ptions, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-clien t\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions optio ns, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Lo calization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOpt ions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet -client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. File.OpenRead(String path) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspro j] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\FileSystem.cs:line 43 [D:\Baid uNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.FromFileInternal(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersi on\src\GitVersion.Core\Model\VersionVariables.cs:line 171 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.<>c__DisplayClass113_0.<FromFile>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion. Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Local ization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.<>cDisplayClass11_0.b0(Context , CancellationToken ) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna -cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retr y.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPre dicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permitt edRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider) [D:\BaiduNetdiskDownload\xna-cncnet -client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retr y.RetryPolicy1.Implementation(Func3 action, Context context, CancellationToken cancellationToken) [D:\BaiduNetdiskDow nload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.Execute(Func3 action, Context context, CancellationToken cancellationToken) [D:\BaiduNetdiskDownload\xna-cncnet-c lient\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.Execute(Func1 action) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspr oj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .Helpers.RetryAction2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction. cs:line 35 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.FromFile(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersion\src\G itVersion.Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localiza tion\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVer sionTaskExecutor.cs:line 24 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspr oj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTasks.<>cDisplayClass0_0.b0(IGitVersionTaskExecutor executor) in D:\a\GitVersion\Git Version\src\GitVersion.MsBuild\GitVersionTasks.cs:line 13 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\GitVersion\GitVersion\src\GitVersion .MsBuild\GitVersionTasks.cs:line 30 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localizat ion.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj]

while D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet nuget list source

注册的源:

  1. NuGet official package source [已启用] https://api.nuget.org/v3/index.json
  2. Local file package source [已启用] D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\References
SadPencil commented 1 year ago

Finally, this issue can be closed as we have found the reason. @Rivendell2898 The official package source must be enabled. By default it is enabled.

Oh, I closed the NuGet official package source when I remove GitVersion.MsBuild packages. Now I opened official package source, rebuilt the project and found the familiar error again

C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : FileNotFoundExce ption: Could not find file 'D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\obj\gitversion.jso n'. [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft. Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOpt ions options) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Microsoft. Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions o ptions, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-clien t\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions optio ns, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Lo calization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOpt ions options, Int64 preallocationSize, Nullable1 unixCreateMode) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet -client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at System.IO. File.OpenRead(String path) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspro j] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .FileSystem.OpenRead(String path) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\FileSystem.cs:line 43 [D:\Baid uNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.FromFileInternal(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersi on\src\GitVersion.Core\Model\VersionVariables.cs:line 171 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.<>c__DisplayClass113_0.<FromFile>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion. Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Local ization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.<>cDisplayClass11_0.b0(Context , CancellationToken ) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna -cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retr y.RetryEngine.Implementation[TResult](Func3 action, Context context, CancellationToken cancellationToken, ExceptionPre dicates shouldRetryExceptionPredicates, ResultPredicates1 shouldRetryResultPredicates, Action4 onRetry, Int32 permitt edRetryCount, IEnumerable1 sleepDurationsEnumerable, Func4 sleepDurationProvider) [D:\BaiduNetdiskDownload\xna-cncnet -client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Retr y.RetryPolicy1.Implementation(Func3 action, Context context, CancellationToken cancellationToken) [D:\BaiduNetdiskDow nload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.Execute(Func3 action, Context context, CancellationToken cancellationToken) [D:\BaiduNetdiskDownload\xna-cncnet-c lient\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at Polly.Poli cy1.Execute(Func1 action) [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspr oj] C:\Users\lcx\.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .Helpers.RetryAction2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction. cs:line 35 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .OutputVariables.VersionVariables.FromFile(String filePath, IFileSystem fileSystem) in D:\a\GitVersion\GitVersion\src\G itVersion.Core\Model\VersionVariables.cs:line 157 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localiza tion\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTaskExecutor.GetVersion(GetVersion task) in D:\a\GitVersion\GitVersion\src\GitVersion.MsBuild\GitVer sionTaskExecutor.cs:line 24 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.cspr oj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTasks.<>cDisplayClass0_0.b0(IGitVersionTaskExecutor executor) in D:\a\GitVersion\Git Version\src\GitVersion.MsBuild\GitVersionTasks.cs:line 13 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\ Localization\Localization.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : at GitVersion .MsBuild.GitVersionTasks.ExecuteGitVersionTask[T](T task, Action`1 action) in D:\a\GitVersion\GitVersion\src\GitVersion .MsBuild\GitVersionTasks.cs:line 30 [D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localizat ion.csproj] C:\Users\lcx.nuget\packages\gitversion.msbuild\5.11.1\tools\GitVersion.MsBuild.targets(19,9): error : [D:\BaiduNetdis kDownload\xna-cncnet-client\xna-cncnet-client\Localization\Localization.csproj]

while D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client>dotnet nuget list source

注册的源:

1. NuGet official package source [已启用]
   https://api.nuget.org/v3/index.json

2. Local file package source [已启用]
   D:\BaiduNetdiskDownload\xna-cncnet-client\xna-cncnet-client\References

This is weird. Since your issue is not reproduceable on other machines I suggest you do a fresh Windows installation.

Rivendell2898 commented 1 year ago

Thanks a lot for all the reply. I think the main reason lies in GitVersion.MsBuild, since the project works well when I remove the package. I think I can currently use without GitVersion.MsBuild. I will try to use another computer later.