Why does "EmbededNativeResources.exe" need to be writeable?

Creator
Creator

Hey Guys,

I'm using the SolidEdgeCommunity nuget package in my project.

My Source Control is giving the EmbededNativeResources.exe read only access.

That is causing errors when i build the project.

Why does this file need  to writeable?

 

Error message while building is the following:

Fehler 1 Der Befehl ""\packages\SolidEdge.Community.107.3.1\build\net40\..\..\Tools\net40\EmbedNativeResources.exe" "\AddIn" "\AddIn\bin\Debug\AddIn.dll"" wurde mit dem Code 5 beendet. Stellen Sie sicher, dass Sie zur Ausführung dieses Befehls berechtigt sind. AddIn

 

My translation:

Error 1 The command .... exited with code 5. Please ensure that you have the rights to run this command

 

Greetings,

Loginator

3 REPLIES

Re: Why does "EmbededNativeResources.exe" need to be writeable?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I am the author of the SolidEdge.Community NuGet package. EmbededNativeResources.exe is executed during the AfterBuild event. Its purpose is to take images with the NativeResource attribute defined in the AssemblyInfo.(cs|vb) file and embed them into the output .dll. This is necessary as Solid Edge requires addins to use native resources for images.

 

Technically speaking, the only file that should be written to is "\AddIn\bin\Debug\AddIn.dll". Exit code 5 is a generic "Access is denied" message. I see two possibilities:

  1. EmbededNativeResources.exe is being blocked from executing.
  2. "\AddIn\bin\Debug\AddIn.dll" is readonly.

You might try running Visual Studio as Administrator to see if you still get the message. That will help me diagnose what's going on.

 

As a test, copy the following XML and paste it into $(SolutionDir)\packages\SolidEdge.Community.107.3.1\build\net40\SolidEdge.Community.targets. Be sure to overwrite the existing XML.

 

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <EmbedNativeResourcesPath>$(MSBuildThisFileDirectory)..\..\Tools\net40\EmbedNativeResources.exe</EmbedNativeResourcesPath>
    <ExecCommand>"$(EmbedNativeResourcesPath)" "$(MSBuildProjectDirectory)" "$(TargetPath)"</ExecCommand>
  </PropertyGroup>
  <Target Name="SolidEdgeCommunity" AfterTargets="AfterBuild">
    <Message Text="Executing: $(ExecCommand)" Importance="High"/>
    <Exec Command="$(ExecCommand)" ContinueOnError="true">
      <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
    </Exec>
    <Message Importance="high" Text="ExitCode: $(ErrorCode)"/>
  </Target>
</Project>

 Rebuild the solution and look at the Ouput window. Mine looks like this.

 

1>------ Build started: Project: MySolidEdgeAddIn1, Configuration: Debug Any CPU ------
1>  MySolidEdgeAddIn1 -> C:\Test\MySolidEdgeAddIn1\MySolidEdgeAddIn1\bin\Debug\MySolidEdgeAddIn1.dll
1>  Executing: "C:\Test\MySolidEdgeAddIn1\packages\SolidEdge.Community.107.3.0\build\net40\..\..\Tools\net40\EmbedNativeResources.exe" "C:\Test\MySolidEdgeAddIn1\MySolidEdgeAddIn1" "C:\Test\MySolidEdgeAddIn1\MySolidEdgeAddIn1\bin\Debug\MySolidEdgeAddIn1.dll"
1>  ExitCode: 0
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

 Reply with your ouput so that I can review it.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Why does "EmbededNativeResources.exe" need to be writeable?

Experimenter
Experimenter

Hello Jason,

I am in the same team of the thread creator "loginator" and we both were working on this point.

That's why I want to thank you also in the name of my team mate for the detailed answer! The hint that the executable file must in fact be executable, was the solution! If files are checked-in in ClearCase they loose per default their execution rights, and once they are checked-out they are executable again.

In Clearcase it is possible to specify for each versioned element its "protection" property on the level of Clearcase access. By setting these rights correctly the issue is solved.

Thank you!!

The Magician Smiley Happy

Re: Why does "EmbededNativeResources.exe" need to be writeable?

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Thanks for the update. I'm glad we were able to resolve the issue promptly.

Jason Newell
Applications Architect
www.jasonnewell.net