I've got a project that was created with ArcGIS Runtime for .NET (Windows). The project comes with the following post-build event:
REM copy runtime deployment folder to output directory pushd $(MSBuildThisFileDirectory)..\..\sdk\net45\ for /d %%i in (arcgisruntime*) do ( xcopy "%%i" "$(TargetDir)%%i\" /S /Y ) popd
I've tried replacing it with my own commands but, not only doesn't my code work, even if I remove all of the post-build event code and save and exit, the Esri post-build event code always comes back as shown above. My code works fine in other projects. It's just the project that was created with ArcGIS Runtime for .NET. Any ideas?
if you run the script separately from visual studio, does it work / what is the error message you get?
In general, you should create deployment folder to the bin folder using Create an ArcGIS Runtime deployment—ArcGIS Runtime SDK for .NET | ArcGIS for Developers tool after that it should be simple copy full folder structure (including arcgisruntimexxxx folder) to the new location.
Me and two other developers have been pulling our hairs for 4 hours to find out where this post build event was coming from and the above reply is definitely not helping.
Hi, Could you describe what is the exact issue that you are running with? Which SDK version you are using and are you using nuget / install approach?
The post build event is in the nuget package (look for the .targets file). This is a required step, or your app won't run, since it deploys required native libraries and resources.
The post above doesn't say what the issue with this is?
We are also encountering this problem.
To be clear, the code that is added to the postbuild event works.
The problem is that we need to add extra code and that is not possible.
Any changes that are made to the postbuild event are ignored.
> To be clear, the code that is added to the postbuild event works.
> The problem is that we need to add extra code and that is not possible.
Could you be more specific?
The v100.x runtime never used to set (or override) the postbuild setting (poor wording used in my earlier response). In v100.0 it defined a target that was dependent on the build. Since v100.1, it instead accomplished this by adding the files as contents instead of using a copy script, so this shouldn't be an issue.
...I just went all the way back to v10.2.7. Yeah. That's bad. Like really bad. I have no idea what we were thinking
You can however work around it. Instead of setting the post build, append to it:
ie
<PostBuildEvent>
$(PostBuildEvent)
REM My other postbuild event stuff here
</PostBuildEvent>
Or declare your own post-build event target (which is what the 10.2.x package probably should have done):
<Target Name="MyPostBuildEvent" AfterTargets="Build">
<PropertyGroup>
<MyPostBuildEventCommand>
REM Run my script here
</MyPostBuildEventCommand>
</PropertyGroup>
<Exec Command="$(MyPostBuildEventCommand)" />
</Target>