I'm running into a conflict when trying to include both of the following packages in a project:
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
or by using:
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.0" />
<FrameworkReference Include="Microsoft.AspNetCore.OpenApi"/>
When I build the project, I get this error:
dotnet build
Restore complete (0.2s)
MyApi net10.0 failed with 1 error(s) (0.0s)
C:\Program Files\dotnet\sdk\10.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(40,5): error MSB4018:
The "ResolvePackageFileConflicts" task failed unexpectedly.
System.FormatException: Input string was not in a correct format. Failure to
parse near offset 103. Expected an ASCII digit.
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provi
der, String format, ReadOnlySpan`1 args)
at System.String.FormatHelper(IFormatProvider provider, String format, Rea
dOnlySpan`1 args)
at Microsoft.NET.Build.Tasks.Logger.CreateMessage(MessageLevel level, Stri
ng format, String[] args)
at Microsoft.NET.Build.Tasks.Logger.LogMessage(MessageImportance importanc
e, String format, String[] args)
at Microsoft.NET.Build.Tasks.ConflictResolution.ConflictResolver`1.Resolve
Conflict(TConflictItem item1, TConflictItem item2, Boolean logUnresolvedConfl
icts)
at Microsoft.NET.Build.Tasks.ConflictResolution.ConflictResolver`1.Resolve
Conflicts(IEnumerable`1 conflictItems, Func`2 getItemKey, ConflictCallback`1
foundConflict, Boolean commitWinner)
at Microsoft.NET.Build.Tasks.ConflictResolution.ResolvePackageFileConflict
s.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecuti
onHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost tas
kHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
Build failed with 1 error(s) in 0.5s
The error randomly appeared when I was renaming my models and their fields in my Web API project that uses Entity Framework Core. Even after reverting those changes or even completely removing the models the error did not go away.
What I've tried
I created a clean project only with these packages and I still get the error:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="10.0.0" />
</ItemGroup>
</Project>
I've tried:
- Testing different package versions (
9.0.9,9.0.11,10.0.0); - Using different SDK versions (
9.0.305,9.0.307,10.0.100) - Clearing all NuGet and .NET caches;
- Completely reinstalling .NET, NuGet and removing VS;
- Running the project on another machine (works fine there).
The project builds fine if only one of these packages is included, but fails when both are present.
Does anyone have any ideas on how to fix this?
System.FormatException: Input string was not in a correct format. Failure to parse near offset 103. Expected an ASCII digit.makes me curious. Is your code located in a path with some unexpected non-ascii chars perhaps? What if you just put it inC:\MyProjector something?