Microsoft.WindowsAzure.targets "The specified path, file name,or both are too long" - azure

I am trying to publish a project to Windows Azure but get an error in the generated Microsoft.WindowsAzure.targets file related to length of paths and file names. How can I determine which is the problematic path or filename. The error relates to the "" tag in the generated file
Thanks
Martin

Already an older post - did you check this post?
Path too long error when building a windows azure service
This might reslove your issue.

Since this was still a problem for me years later and the above doesn't apply to Azure SDK v2.8, I was able to solve it by creating a symbolic link to my projects folder. Open up the command prompt as an administrator and run this:
mklink /D C:\Dev C:\Users\danzo\Source\Workspaces
Obviously you can change "C:\Dev" to whatever you want it to be and you'll need to change the longer path above to the root directory of your soltions/projects folder.

Related

How do i formulate file path for testsettings on the Runsettings file parameter <SettingsFile>

Whats the proper way to form relative file path/ or file path for the runsettings parameter
<SettingsFile>xxxxxAutomation.testsettings</SettingsFile>
In my local environment this works but when i push it to build release agents it fails since
its looking for the file in a different directory which is my release folder
but instead its looking for this file in what appears to be in a folder directory.
This is the directory its looking at E:\Agent_work\r10\a\xxxxxxxxx.testsettings,
here is my current way i have it set
<SettingsFile>xxxxxAutomation.testsettings</SettingsFile>
here is the error message
Error: The test settings file E:\Agent_work\r10\a\xxxxxxxxxx.testsettings, specified in the MSTestAdapter settings, is not available. Either access to the file is denied or the file does not exist. Ensure that the test settings file is available and try again.
instead of
E:\Agent_work\r10\a_XXXXX CI Build\drop\XXXXX_Automation_Test\bin\Release\xxxxxxxxx.testsettings
There is no documentation that states how to formulate the file path on msdn and didn't see
anything online.
I suggest you can add a Copy Files task to copy the missing file from .../bin/release folder(Use the browse option) to default working directory:
I suggest you resolve this issue via modifying your pipeline instead of settings file, so that you can also work well locally with the unchanged runsettings file.
In addition: Clean Target Folder input should be disabled(unchecked) cause our target folder is the default working folder. Deleting all files in that folder would cause unexpected issues.

Unable to run dotnet under certain directories?

I am using the command: dotnet "myfile.dll"
Initially it was giving me this error: The user's home directory could not be determined. Set the 'DOTNET_CLI_HOME' environment variable to specify the directory to use.
Now after messing around with it, I have moved my files to c:/mydir, and it is giving this error: Failed to initialize CoreCLR, HRESULT: 0x80070057. I found this, but isn't c:/mydir a drive root?
Couple of things I noted:
I am able to run the .dll fine in a different directory.
Both directories contain same files.
The reason I want to run it in c:/mydir is because I am using AWS CodeDeploy, and that is where it copies the files (as far as I know; and the other directories are just the old versions where the files get copied from).
These issues are not linked (the first one I get from running a automated shell script after installation, and the second I get from manually trying to launch the .dll).
If someone could help me solve either one of these issues it would be greatly appreciated.
Try adding Environment=DOTNET_CLI_HOME=/temp to your Service declaration in your .service file. Example syntax:
[Service]
...
Environment=VARNAME=VARCONTENTS
So the actual like would look like this
Environment=DOTNET_CLI_HOME=/temp

What is the reason for nodemon working in cmd but not in a batch file?

I am in the process of making a discord bot. All of the code that I have written for the bot works except for the batch file that is supposed to run it. Originally I was just using the node command and when I opened cmd, navigated to the folder, and typed it manually it worked fine, but when I put that same code into a batch file it gave me this error:
'node' is not recognized as an internal or external command, operable program or batch file.
This is all the code for that batch file:
#echo off
node bot.js
pause
The node command was in my path so I'm not sure why it wasn't working, but in another post, someone recommended that instead of typing just node to type the full file path, so I tried this and it worked.
Here is the new working code:
#echo off
"C:\Program Files\nodejs\node.exe" bot.js
pause
Then I installed nodemon. Again this works in the cmd when I navigated to the folder and typed it manually, but when I try to do it in the batch file it does not work. Instead of giving me the error it had been before the window just instantly closes. Here is that code:
#echo off
nodemon bot.js
pause
Since I have the pause command at the end of the code it should stop there if I get an error, but it is closing before it gets there for some reason. The nodemon command is in my path and I have also tried replacing nodemon with the file path, C:\Users\tdkni\AppData\Roaming\npm\nodemon.cmd, like I was recommended in the previous post. Neither of these solutions worked, and I think that is because there is some other problem besides the nodemon command not being detected. I don't see any error message since it is closing instantly so I don't know exactly what is wrong.
The registration of the file extensions .bat and .cmd is as follows according to an advice in a comment deleted in the meantime.
Well, it is pretty clear why node.exe was not found by cmd.exe in directory C:\Program Files\nodejs.
Local Path being system and user Path concatenated contains "C:\Program Files\nodejs;" instead of just C:\Program Files\nodejs.
Folder paths in Path should be never enclosed in double quotes with one exception: The folder path itself contains one or more ;. In this case the folder path with ; must be enclosed in double quotes to get the semicolon(s) in folder path not interpreted as separator between the folder paths. That is general CSV syntax as described on Wikipedia article comma-separated values which is used by Windows for the folder paths in Path with using semicolon as separator.
For that reason cmd.exe searches in a folder with name C:\Program Files\nodejs; for node.* with a file extension listed semicolon separated in environment variable PATHEXT. But there is no folder C:\Program Files\nodejs; because the folder is C:\Program Files\nodejs without the semicolon at end.
And also PATHEXT is defined wrong as it contains at end the folder path C:\Program Files\nodejs although it should contain only file extensions separated by a semicolon.
Other small mistakes:
The first 4 folder paths in system PATH should be always:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0
Some installers add folder paths at beginning of folder paths list instead of appending them at end as it can be seen here. The Intel64 compiler and the Oracle Java folder paths should be moved in system PATH after PowerShell folder path.
Folder paths can but should not end with a backslash. All backslashes at end of a folder path should be removed from system and user PATH. Microsoft added since Windows Vista the PowerShell path with a trailing backslash for some unknown reason. But it is safe and recommended to nevertheless remove the backslash after WindowsPowerShell\v1.0.
System and user Path (if latter is existing at all) and also PATHEXT should not end with a semicolon. There should be no ; after last folder path respectively last file extension as this means according to CSV specification that there is one more value (folder path, file extension) which is an empty value.
I recommend to define system Path with following value respectively folder paths:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0;%SystemRoot%\System32\OpenSSH;%ProgramFiles(x86)%\Common Files\Intel\Shared Libraries\redist\intel64\compiler;%ProgramFiles(x86)%\Common Files\Oracle\Java\javapath;%ProgramFiles%\nodejs;%ProgramFiles(x86)%\Windows Kits\8.1\Windows Performance Toolkit
I recommend to define user Path with following value respectively folder paths:
%LocalAppData%\Microsoft\WindowsApps;%AppData%\npm
Those two folder paths are user account related and should be added for that reason to user and not system Path.
I recommend to fix system environment variable PATHEXT to:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
For more details about usage of Path and PATHEXT see the answer on What is the reason for '...' is not recognized as an internal or external command, operable program or batch file? Please take also a look on Wikipedia article about Windows Environment Variables.
Here's my answer to the original question, for the benefit of other Windows users (Linux/Mac users not my problem).
In essence, user is trying to run some script.js file with nodemon;
C:\path\to\my\project>nodemon bot.js
, and wants to put in a batch file.
If nodemon is installed globally -g, it installs under
C:\Users\<YourLogin>\AppData\Roaming\npm\nodemon.cmd
So your batch file should be
cd C:\path\to\my\project\
%AppData%\npm\nodemon.cmd bot.js
PAUSE press any key to exit
I'd like to thank all of you for trying to help me with this problem I was having. You have all been very helpful, and while it may not have fixed my problem it did help me understand how all of this works. I just tried to start the bot using the batch file I made and it suddenly worked. I don't know why because I tried to start it the same way I had been the entire time, but as far as I could find, no one else was having this issue anyways so it probably won't matter much that I don't know what fixed it. Again, thank you to everyone that helped me with this.
Give this a try for us please, if it works, I will explain:
#echo off
cd /d "C:\Users\tdkni\AppData\Roaming\npm"
echo Testing Script > OUTPUT.log
nodemon.cmd bot.js >> OUTPUT.log
pause
I know this thread is older but I faced the same issue today. If someone like me stumbled across, based on joedotnot's answer, here is what it fixed for me.
devserver.cmd
#echo off
echo Auto Starting Development Server
cmd /k "cd x:\cmdproxy & config\env.cmd & %AppData%\npm\nodemon.cmd"
Where X: is the development folder on the VM Host System mapped as Network Drive in the development Guest System. And config\env.cmd is another batch file which holds some env settings.
My server file is named index.js so there was no need to add is as argument. Nodemon finds the file automatically.

CSPack-created package file is missing \siteroot folder

I am using cspack command to create cspkg as part of build. The command that I am using is
cspack.exe D:\StoreSimplePortal\StorSimple-Portal\src\StorSimple.CloudService\ServiceDefinition.csdef /out:StorSimple.CloudService.cspkg /role:StorSimpleExtension;D:\StoreSimplePortal\StorSimple-Portal\out\debug-AMD64\StorSimpleExtension /sitePhysicalDirectories:StorSimpleExtension;Web;D:\StoreSimplePortal\StorSimple-Portal\out\debug-AMD64\StorSimpleExtension /rolePropertiesFile:StorSimpleExtension;D:\StoreSimplePortal\StorSimple-Portal\src\StorSimple.CloudService\RoleProperties.txt
The build succeeds but /sitesroot folder is not created. Am I missing something here.
Can you verify that the sitesroot is in the StorSimpleExtension directory? If it is not, verify that it is included in the .csproj file.
The problem seems to occur when the site physical directory parameter is too similar to the role path parameter. Try altering the path parameter to:
/sitePhysicalDirectories:StorSimpleExtension;Web;D:\StoreSimplePortal\StorSimple-Portal\out\debug-AMD64\storSimpleExtension\
Note the added '\' and lowercase directory name.
See this question for more details:
https://social.msdn.microsoft.com/Forums/azure/en-US/014ce124-5ca6-46ce-b1ea-3d677a092f65/azure-sdk-16-cspack-command-line-tool?forum=windowsazuredevelopment

Unable to publish VS project to Azure due to file name length despite having shortened temporary directory

I am unable to publish a project to Azure from Visual Studio. I am running into an issue because I am getting the following error:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
I have already tried many common solutions. The problem arises in the temporary directory location, but I have shortened this. The directory that is too long is b:\test\WebSitePublish\WebProject-1309592107\obj\Debug\Package\PackageTmp\node_modules\grunt-bower\node_modules\bower\node_modules\request\node_modules\form-data\node_modules\combined-stream\node_modules\delayed-stream\test\integration\test-delayed-http-upload.js, starting with a short directroy name.
I have also tried installing npm install -g flatten-packages but get the same error.
How can I make this project push?

Resources