我从以下网址下载了.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
Run Code Online (Sandbox Code Playgroud)
从代码分析我可以看到无效路径位于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>
Run Code Online (Sandbox Code Playgroud)
所以看起来$(Platform)宏是无效的.如何修复此错误以构建我的解决方案?我正在使用VS 2013 express for desktop来构建我的解决方案.
小智 6
我遇到了同样的问题,MS Connect上的以下项目为我工作:https://connect.microsoft.com/VisualStudio/feedback/details/811986/-frameworksdkdir-value-in-vs-macros-post-build-事件引用-无效路径
最佳做法是使用$(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>
Run Code Online (Sandbox Code Playgroud)
令人不安的是:
SdkPath="$(FrameworkSDKDir)"/>
Run Code Online (Sandbox Code Playgroud)
在较新版本的Visual Studio中应将其更改为以下内容:
SdkPath="$(SDK40ToolsPath)"/>
Run Code Online (Sandbox Code Playgroud)
导致文件:
<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>
Run Code Online (Sandbox Code Playgroud)
这将修复构建错误"系统找不到指定的文件"以及"此ANSI插件与您的Unicode Notepad ++不兼容"