从文件中读取异常清单。 Microsoft Word加载项VSTO

问题描述 投票:1回答:1

我正在尝试创建一个Microsoft Word加载项,它将在每次保存Word文档时(自动保存或手动保存)添加并提交到git repo。当我从Visual Studio(调试模式)中运行程序时,已经能够获得所需的功能。当我发布并安装外接程序以便在Word启动时运行时,出现以下错误。

enter image description here

现在,当我尝试添加LibGit2Sharp NuGet软件包时,在Visual Studio中以调试模式运行时会出现此错误:

enter image description here

以及以下错误详细信息:

Name: 
From: file:///C:/Users/short/OneDrive for Business/SCHOOL/JP/EZGit/EZGit/MicrosoftWordAddIn/bin/Debug/MicrosoftWordAddIn.vsto

************** Exception Text **************
System.Deployment.Application.InvalidDeploymentException: Exception reading manifest from file:///C:/Users/short/OneDrive%20for%20Business/SCHOOL/JP/EZGit/EZGit/MicrosoftWordAddIn/bin/Debug/MicrosoftWordAddIn.dll.manifest: the manifest may not be valid or the file could not be opened. ---> System.Deployment.Application.InvalidDeploymentException: Application manifest is not semantically valid. ---> System.Deployment.Application.InvalidDeploymentException: File element lib\fedora-x64\native\..\libgit2-106a5f2.so must have a relative path.
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateFile(File f)
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSemanticsForApplicationRole()
   --- End of inner exception stack trace ---
   at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSemanticsForApplicationRole()
   at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.GetManifests(TimeSpan timeout)
   at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn() 

我认为已发布的解决方案需要这些软件包,但是没有它们就可以在Visual Studio中使用。我安装它们以查看,然后在Visual Studio中运行会导致错误。

我尝试更改.csproj文件以添加以下内容

<Target Name="EnsureNetstandardFilesAreIncludedInClickOnce" BeforeTargets="_DeploymentComputeClickOnceManifestInfo">
    <Message Text="Adding netstandard files to ClickOnce" />
    <ItemGroup>
      <PublishFile Include="@(_NETStandardLibraryNETFrameworkLib->'%(FileName)')" KeepMetadata="None">
        <PublishState>Include</PublishState>
        <FileType>Assembly</FileType>
      </PublishFile>
    </ItemGroup>
    <!-- Consider using ReferenceCopyLocalPaths instead, if we are missing files -->
    <Message Text="Adding nuget files to ClickOnce" />
    <ItemGroup>
      <PublishFile Include="@(ReferencePath->'%(FileName)')" Condition=" '%(ReferencePath.NuGetSourceType)' == 'Package' and '%(ReferencePath.NuGetIsFrameworkReference)' != 'true'" KeepMetadata="None">
        <PublishState>Include</PublishState>
        <FileType>Assembly</FileType>
      </PublishFile>
    </ItemGroup>
    <Message Text="Adding Private True references to ClickOnce" />
    <ItemGroup>
      <PublishFile Include="@(ReferencePath->'%(FileName)')" Condition="'%(ReferencePath.Private)' == 'True'" KeepMetadata="None">
        <PublishState>Include</PublishState>
        <FileType>Assembly</FileType>
      </PublishFile>
    </ItemGroup>
  </Target>
c# visual-studio ms-word vsto libgit2sharp
1个回答
0
投票

我也遇到了这个问题,并通过删除顶部csproj文件中的import语句解决了该问题。 lib2git库仍在ItemGroup部分中引用]

© www.soinside.com 2019 - 2024. All rights reserved.