C# 记事本++;插件构建错误VS 2013
我已从以下网站下载了.NET的notepad++插件: 当我尝试构建解决方案时,会出现以下错误:C# 记事本++;插件构建错误VS 2013,c#,.net,notepad++,C#,.net,Notepad++,我已从以下网站下载了.NET的notepad++插件: 当我尝试构建解决方案时,会出现以下错误: 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 expa
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
该“DllExportTask”任务意外失败。
System.ArgumentException:路径不是合法形式。
在System.IO.Path.NormalizePath(字符串路径、布尔完整检查、Int32 maxPathLength、布尔扩展短路径)
位于System.IO.Path.GetFullPathInternal(字符串路径)
在System.IO.Path.GetFullPath(字符串路径)处
位于NppPlugin.DllExport.MSBuild.DllExportTask.TrySearchToolPath(字符串工具路径、字符串工具文件名、字符串和值)
在NppPlugin.DllExport.MSBuild.DllExportTask.ValidateInputValues()处
在NppPlugin.DllExport.MSBuild.DllExportTask.Execute()处
位于Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute()
在Microsoft.Build.BackEnd.TaskBuilder.d_u20.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>
因此,$(平台)宏似乎无效。如何修复此错误以生成解决方案?我正在使用VS 2013 express for desktop构建解决方案。我遇到了相同的问题,MS Connect上的以下项目对我有效:
最佳做法是使用$(SDK40ToolsPath)属性获取.NET SDK二进制文件路径,而不是使用$(FrameworkSDKDir)属性手动构建路径。使用“$(SDK40ToolsPath)sgen.exe”应该可以在Visual Studio 2013和早期版本中使用。我刚刚遇到了同样的问题,我找不到任何具体的答案。以下是我所做的: 文件{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>
在较新版本的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记事本不兼容”“$(平台)是当前项目平台的名称(例如,“Win32”)。“您的项目是否设置了生成平台?我得到了相同的生成失败,但我认为这是因为
$(TargetedFrameworkDir);
包含一个双反斜杠(即\\
),生成日志显示任务参数:FrameworkPath=C:\Windows\Microsoft.NET\Framework\\v4.5;C:\Program Files(x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\;;C:\Program Files(x86)\参考Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\(TaskId:44)
<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>