当我尝试构建我的解决方案时,它会出现以下错误:
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>
所以似乎$(平台)宏无效。如何修复此错误以构建我的解决方案?我正在使用VS 2013 express for desktop来构建我的解决方案。
答案 0 :(得分:6)
我遇到了同样的问题,MS Connect上的以下项目为我工作:https://connect.microsoft.com/VisualStudio/feedback/details/811986/-frameworksdkdir-value-in-vs-macros-post-build-event-references-invalid-path
最佳做法是使用 $(SDK40ToolsPath)属性获取.NET SDK二进制文件路径,而不是使用 $(FrameworkSDKDir)>手动构建路径强>财产。使用“$(SDK40ToolsPath)sgen.exe”应该可以在Visual Studio 2013和早期版本中使用。
答案 1 :(得分:6)
我刚刚遇到同样的问题,我找不到任何具体的答案。这是我做的:
文件{Project Dir} /DllExport/NppPlugin.DllExport.targets的内容将是:
body, html{
width: 100%;
height: 100%;
}
<body>
<table class="flash-container" style="height: 100%; width:100%">
<tr style="height: 100%; width:100%">
<td style="height: 100%; width:100%">
<object width="100%" height="100%">
<param name="autoPlay" value="true"></param>
<embed allowfullscreen="true" autoPlay="true" flashvars="autoplay=true&play=ture" allownetworking="all" id="pptShow" allowscriptaccess="always" height="100%" src="http://www.weilaijiaoxue.com:9096/upload/2016/4/13/swf_20160413115509559.swf" type="application/x-shockwave-flash" width="100%"></embed>
</object>
</td>
</tr>
</table>
</body>
令人不安的是:
<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="$(FrameworkSDKDir)"/>
导致文件:
SdkPath="$(SDK40ToolsPath)"/>
这将修复构建错误&#34;系统无法找到指定的文件&#34;以及&#34;此ANSI插件与您的Unicode Notepad ++&#34;
不兼容