Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Notepad++ plugin build error VS 2013

Tags:

c#

.net

notepad++

I have downloaded the notepad++ plugin for .NET from: http://sourceforge.net/projects/sourcecookifier/files/other%20plugins/NppPlugin.NET.v0.5.zip/download

When I try to build my solution it gives the following error:

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

From the Code analysis I could see that the invalid path is located in NppPlugin.DllExport.targets(4,5), the contents of the file is:

<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>  

So it seems the $(Platform) macro is invalid. How can I fix this error to build my solution? I am using VS 2013 express for desktop to build my solution.

like image 302
Morne Avatar asked May 06 '14 14:05

Morne


2 Answers

I just came across this same issue, and nothing I could find gave a concrete answer. Here is what I did:

The contents of the file {Project Dir}/DllExport/NppPlugin.DllExport.targets will be:

<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>

The troubling line is:

SdkPath="$(FrameworkSDKDir)"/>

Which should be changed to the following in newer versions of Visual Studio:

SdkPath="$(SDK40ToolsPath)"/>

Resulting in the file:

<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>

This will fix the build error "The system cannot find the file specified" as well as "This ANSI plugin is not compatible with your Unicode Notepad++"

like image 192
AlbinoDrought Avatar answered Nov 03 '22 10:11

AlbinoDrought


I ran into the same problem, the following item on MS Connect worked for me: https://connect.microsoft.com/VisualStudio/feedback/details/811986/-frameworksdkdir-value-in-vs-macros-post-build-event-references-invalid-path

It is best practice to use the $(SDK40ToolsPath) property to get the .NET SDK binaries path rather than manually building the path with the $(FrameworkSDKDir) property. Using “$(SDK40ToolsPath)sgen.exe” should work in Visual Studio 2013 and earlier versions.

like image 35
Geuko Rooseboom Avatar answered Nov 03 '22 12:11

Geuko Rooseboom