c# - Notepad++ 插件构建错误 VS 2013

标签 c# .net notepad++

我已经从以下位置下载了适用于 .NET 的 Notepad++ 插件:http://sourceforge.net/projects/sourcecookifier/files/other%20plugins/NppPlugin.NET.v0.5.zip/download

当我尝试构建我的解决方案时,出现以下错误:

The "DllExportTask" task failed unexpectedly.
System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength,Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.Path.GetFullPath(String path)
at NppPlugin.DllExport.MSBuild.DllExportTask.TrySearchToolPath(String toolPath, String toolFilename, String& value)
at NppPlugin.DllExport.MSBuild.DllExportTask.ValidateInputValues()
at NppPlugin.DllExport.MSBuild.DllExportTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()    NppManagedPluginDemo.VS2010

从代码分析我可以看出无效路径位于 NppPlugin.DllExport.targets(4,5),文件内容为:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="NppPlugin.DllExport.MSBuild.DllExportTask" AssemblyFile="NppPlugin.DllExport.MSBuild.dll"/>
  <Target Name="AfterBuild" DependsOnTargets="GetFrameworkPaths">
     <DllExportTask Platform="$(Platform)"
               PlatformTarget="$(PlatformTarget)"
               CpuType="$(CpuType)"
               EmitDebugSymbols="$(DebugSymbols)"
               DllExportAttributeAssemblyName="$(DllExportAttributeAssemblyName)"
               DllExportAttributeFullName="$(DllExportAttributeFullName)"
               Timeout="$(DllExportTimeout)"
               KeyContainer="$(KeyContainerName)$(AssemblyKeyContainerName)"
               KeyFile="$(KeyOriginatorFile)"
               ProjectDirectory="$(MSBuildProjectDirectory)"
               InputFileName="$(TargetPath)"
               FrameworkPath="$(TargetedFrameworkDir);$(TargetFrameworkDirectory)"
               LibToolPath="$(DevEnvDir)\..\..\VC\bin"
               LibToolDllPath="$(DevEnvDir)"
               SdkPath="$(FrameworkSDKDir)"/>
  </Target>
</Project>  

所以 $(Platform) 宏似乎无效。如何修复此错误以构建我的解决方案?我正在使用桌面版 VS 2013 Express 来构建我的解决方案。

最佳答案

我刚刚遇到了同样的问题,但我找不到任何具体的答案。这是我所做的:

文件 {Project Dir}/DllExport/NppPlugin.DllExport.targets 的内容将是:

<Project
  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="NppPlugin.DllExport.MSBuild.DllExportTask"
             AssemblyFile="NppPlugin.DllExport.MSBuild.dll"/>
  <Target Name="AfterBuild"
          DependsOnTargets="GetFrameworkPaths"
          >
    <DllExportTask Platform="$(Platform)"
                   PlatformTarget="$(PlatformTarget)"
                   CpuType="$(CpuType)"
                   EmitDebugSymbols="$(DebugSymbols)"
                   DllExportAttributeAssemblyName="$(DllExportAttributeAssemblyName)"
                   DllExportAttributeFullName="$(DllExportAttributeFullName)"
                   Timeout="$(DllExportTimeout)"
                   KeyContainer="$(KeyContainerName)$(AssemblyKeyContainerName)"
                   KeyFile="$(KeyOriginatorFile)"
                   ProjectDirectory="$(MSBuildProjectDirectory)"
                   InputFileName="$(TargetPath)"
                   FrameworkPath="$(TargetedFrameworkDir);$(TargetFrameworkDirectory)"
                   LibToolPath="$(DevEnvDir)\..\..\VC\bin"
                   LibToolDllPath="$(DevEnvDir)"
                   SdkPath="$(FrameworkSDKDir)"/>
  </Target>
</Project>

麻烦的是:

SdkPath="$(FrameworkSDKDir)"/>

在较新版本的 Visual Studio 中应更改为以下内容:

SdkPath="$(SDK40ToolsPath)"/>

生成文件:

<Project
  xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="NppPlugin.DllExport.MSBuild.DllExportTask"
             AssemblyFile="NppPlugin.DllExport.MSBuild.dll"/>
  <Target Name="AfterBuild"
          DependsOnTargets="GetFrameworkPaths"
          >
    <DllExportTask Platform="$(Platform)"
                   PlatformTarget="$(PlatformTarget)"
                   CpuType="$(CpuType)"
                   EmitDebugSymbols="$(DebugSymbols)"
                   DllExportAttributeAssemblyName="$(DllExportAttributeAssemblyName)"
                   DllExportAttributeFullName="$(DllExportAttributeFullName)"
                   Timeout="$(DllExportTimeout)"
                   KeyContainer="$(KeyContainerName)$(AssemblyKeyContainerName)"
                   KeyFile="$(KeyOriginatorFile)"
                   ProjectDirectory="$(MSBuildProjectDirectory)"
                   InputFileName="$(TargetPath)"
                   FrameworkPath="$(TargetedFrameworkDir);$(TargetFrameworkDirectory)"
                   LibToolPath="$(DevEnvDir)\..\..\VC\bin"
                   LibToolDllPath="$(DevEnvDir)"
                   SdkPath="$(SDK40ToolsPath)"/>
  </Target>
</Project>

这将修复构建错误“系统找不到指定的文件”以及“此 ANSI 插件与您的 Unicode Notepad++ 不兼容”

关于c# - Notepad++ 插件构建错误 VS 2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23497591/

相关文章:

java - 链接一个元素

c# - User.Identity.Name 大小写问题

c# - 从 Windows 服务启动浏览器

c# - Parallel.ForEach 中长时间运行进程的进度条

c# - Windows Phone 8.1 中的后台线程

regex - 匹配一个换行符,但不匹配两个

c# - 将在运行时生成的类型(通过 TypeBuilder)传递给 GenericClass

c# - Windows 任务栏右键菜单中的标题

c# - 将接口(interface) B 的实现转换为接口(interface) A 的实现

php - 关于跟踪 div 比 notepad++ 更好的软件的问题