A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/tintoy/msbuild-project-tools-server/issues/100 below:

Cannot redefine/reassign a property in the same file · Issue #100 · tintoy/msbuild-project-tools-server · GitHub

System.ArgumentException: An item with the same key has already been added.
System.InvalidOperationException: Parent project does not have an MSBuild project.

My ZipPublishDir Target defines a Destination property. Then it conditionally appends to the value.

<RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildProjectDirectory)'))))</RepoRoot>
<Destination>$(RepoRoot)/publish/$(AssemblyName).$(Version)$(PART_RuntimeIdentifier)</Destination>
<Destination Condition="'$(RuntimeIdentifier)' != '' ">$(Destination).$(RuntimeIdentifier)</Destination>

MSBuild reassigns the value to the existing property–or redefines it–as expected.
msbuild-project-tools-server cannot handle reassignments. Instead, it throws System.ArgumentException. Consequently, it cannot load any project importing a file containing this usage.

When adding a key that already exists, msbuild-project-tools-server should

error caused by ZipPublishDir

[Error - 5:23:01 AM] Unhandled exception in OnHover.
System.ArgumentException: An item with the same key has already been added. Key: file:///c%3A/Repos/BinToss/GroupBox.Avalonia/node_modules/%40halospv3/hce.shared-config/dotnet/ZipPublishDir.targets
   at bool System.Collections.Generic.Dictionary<TKey, TValue>.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at Task<ProjectDocument> MSBuildProjectTools.LanguageServer.Documents.Workspace.GetProjectDocument(Uri documentUri, bool reload)+(Uri _) => { }
   at async Task<ProjectDocument> MSBuildProjectTools.LanguageServer.Documents.Workspace.GetProjectDocument(Uri documentUri, bool reload)
   at async Task<Hover> MSBuildProjectTools.LanguageServer.Handlers.HoverHandler.OnHover(TextDocumentPositionParams parameters, CancellationToken cancellationToken)
   at async Task<Hover> MSBuildProjectTools.LanguageServer.Handlers.HoverHandler.OmniSharp.Extensions.JsonRpc.IRequestHandler<OmniSharp.Extensions.LanguageServer.Protocol.Models.TextDocumentPositionParams,OmniSharp.Extensions.LanguageServer.Protocol.Models.Hover>.Handle(?)

ZipPublishDir

<Project>
  <!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/zipdirectory-task?view=vs-2022 -->
  <Target Name="ZipPublishDir" AfterTargets="Publish">
    <PropertyGroup>
      <RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildProjectDirectory)'))))</RepoRoot>
      <Destination>$(RepoRoot)/publish/$(AssemblyName).$(Version)$(PART_RuntimeIdentifier)</Destination>
      <Destination Condition="'$(RuntimeIdentifier)' != '' ">$(Destination).$(RuntimeIdentifier)</Destination>
    </PropertyGroup>

    <ZipDirectory
      SourceDirectory="$(PublishDir)"
      DestinationFile="$(Destination).zip"
      Overwrite="true" />
  </Target>
</Project>

error in project importing ZipPublishDir

[Error - 5:36:55 AM] Error loading MSBuild project '"c:\Repos\BinToss\GroupBox.Avalonia\GroupBox.Avalonia.Sample\GroupBox.Avalonia.Sample.csproj"'.
System.InvalidOperationException: Parent project does not have an MSBuild project.
   at bool MSBuildProjectTools.LanguageServer.Documents.SubProjectDocument.TryLoadMSBuildProject()
[Warn  - 5:36:55 AM] Reloaded project file "c:\Repos\BinToss\GroupBox.Avalonia\GroupBox.Avalonia.Sample\GroupBox.Avalonia.Sample.csproj" (XML is valid, but MSBuild project is not).

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4