"Could not copy" Error WPF Local Server .Net SDK

829
5
Jump to solution
09-29-2020 11:52 PM
Arun_PrasadRamanujadoss
New Contributor III

I am trying to create a WPF application which uses Local server SDK. I have installed Local Server SDK and the Localservices NuGet package to the project. When I am trying to create the project I am getting this "Could not copy" error.

Kindly help me overcome this issue.

Regards,

Arun

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor

Hi,

Unfortunately that means your output folder path length is still exceeds 260 characters once the destination path of these LocalServer files is appended. You have two options:

1. Shorten your output path 

Consider using relative paths in your project to define a shorter output location (either via the Project > Properties dialog > Build tab or directly in the .csproj file e.g. `<OutputPath>..\..\..\..\bin\</OutputPath>`.

2. Disable the automatic deployment of Local Server and use the Deployment Builder GUI

- Open the file `ArcGISLocalServer_100.9.AGSDeployment` in your Project folder

- Set the top-level ArcGIS Pro node to false `<Package id="Pro" name="ArcGIS Pro Compatible Server" enabled="false">`.

- Ensure the top-level ArcMap node is also false `<Package id="ArcMap" name="ArcMap Compatible Server" enabled="false">`.

- Note at this point you're now setup for the API to use the SDK installation (in Program Files (x86)) : this can actually be a good approach for everyday development because everything will work and avoids file copies *but* when you're ready to start thinking about building setups/deployments then you definitely want to switch back to using a deployment and you must ensure everything works with the deployment options you have chosen. Read on to use the Deployment Builder GUI...

- Open the Deployment Builder GUI (search in Start Menu or go to `C:\Program Files (x86)\ArcGIS SDKs\LocalServer100.9\Tools\DeploymentBuilder.exe`).

- Use the GUI to choose your deployment options and create a deployment.

- Deployments are typically created in `C:\Users\<username>\Documents\ArcGIS\Runtime Deployments\<deployment_name>`.

- Copy the `localserver100.9` folder created by the deployment builder GUI to the same folder as your application exe (for testing/debug). 

We'll review the approach we're taking and see if there are any opportunities to reduce folder depth / file name length and avoid these path length issues. 

Thanks

Mike

View solution in original post

5 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Those errors are due to the output/deployment destination folder length being greater than 260 characters. 

To resolve those errors your project output location should be reduced. Consider using relative paths in your project to define a shorter output location (either via the Project > Properties dialog > Build tab or directly in the .csproj file e.g. `<OutputPath>..\..\..\bin\</OutputPath>`.

Thanks

Mike 

MichaelBranscomb
Esri Frequent Contributor

...a recently discovered tip: you can use the project property `AppendTargetFrameworkToOutputPath` to remove the target framework moniker from your output path (n this case `netcoreapp3.1`)

e.g. `<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>`

For a little more info see AppendTargetFrameworkToOutputPath, OutputPath, BaseOutputPath, AppendRuntimeIdentifierToOutputPath ·... 

Thanks

Mike

Arun_PrasadRamanujadoss
New Contributor III

Hi,

Thanks for the answer. I have tried the above suggestion and added the AppendTargetFrameWorkToOutputPath property to the Project and it definitely reduced the error count from 64 to 10. But I am still facing the issue.

Kindly direct me if I have to change any more properties to resolve the issue

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Unfortunately that means your output folder path length is still exceeds 260 characters once the destination path of these LocalServer files is appended. You have two options:

1. Shorten your output path 

Consider using relative paths in your project to define a shorter output location (either via the Project > Properties dialog > Build tab or directly in the .csproj file e.g. `<OutputPath>..\..\..\..\bin\</OutputPath>`.

2. Disable the automatic deployment of Local Server and use the Deployment Builder GUI

- Open the file `ArcGISLocalServer_100.9.AGSDeployment` in your Project folder

- Set the top-level ArcGIS Pro node to false `<Package id="Pro" name="ArcGIS Pro Compatible Server" enabled="false">`.

- Ensure the top-level ArcMap node is also false `<Package id="ArcMap" name="ArcMap Compatible Server" enabled="false">`.

- Note at this point you're now setup for the API to use the SDK installation (in Program Files (x86)) : this can actually be a good approach for everyday development because everything will work and avoids file copies *but* when you're ready to start thinking about building setups/deployments then you definitely want to switch back to using a deployment and you must ensure everything works with the deployment options you have chosen. Read on to use the Deployment Builder GUI...

- Open the Deployment Builder GUI (search in Start Menu or go to `C:\Program Files (x86)\ArcGIS SDKs\LocalServer100.9\Tools\DeploymentBuilder.exe`).

- Use the GUI to choose your deployment options and create a deployment.

- Deployments are typically created in `C:\Users\<username>\Documents\ArcGIS\Runtime Deployments\<deployment_name>`.

- Copy the `localserver100.9` folder created by the deployment builder GUI to the same folder as your application exe (for testing/debug). 

We'll review the approach we're taking and see if there are any opportunities to reduce folder depth / file name length and avoid these path length issues. 

Thanks

Mike

Arun_PrasadRamanujadoss
New Contributor III

Hi Mike.,

Thanks a lot for your step-by-step guide to resolve the issue.

The above answer is clear and resolved my issue. Now I can able to generate a working build of the application.

Regards,

Arun

0 Kudos