I have project that I build with the following command in zsh on a Windows 10 machine:
devenv $sln -project $project -rebuild "Release|x64"
If I run it locally in a terminal, it always works. I am however running it via the task scheduler and sometimes via (cygwin) ssh. It still works, but only if I'm actually logged into the machine locally or with a remote desktop session.
If the command is run when the user is signed out, I see the following message:
Microsoft Visual Studio has detected a configuration issue. To correct this, please restart as Administrator. For more information please visit: http://go.microsoft.com/fwlink/?LinkId=320596
Example using ssh.
When I say "physical machine" I mean the host machine where the command is run.
I have an up to date Windows 10 Professional machine and up to date Visual Studio 2013.
It also fails if the command is run via windows task scheduler (set to work when not logged in with highest privileges), while the user is signed out.
Setting devenv to always open as Administrator (using all the methods I've seen on S.O.) doesn't help. Disabling UAC doesn't help.
I would opt to just leave the machine logged in all the time, however the problem also occurs is after a Remote Desktop session:- If I remote desktop into that machine, the command continues to work while I have the remote session open (even via ssh and task scheduler), but as soon as I disconnect the rdp session it stops working.
Edit: The correct user profile is loaded at the point of execution and the devenv activity log reveals no errors or warnings. The log merely shows that devenv exits after Client rights determined
.
Edit: I've tested @Callan's msbuild
solution and it seems to work for all my projects using the following for solution builds:
msbuild $sln /t:Rebuild /p:Configuration=Release;Platform=x64
And the following for single project builds (Found here):
msbuild $sln /t:"$project:Rebuild" /p:Configuration=Release;Platform=x64 /p:BuildProjectReferences=false
This isn't strictly a solution to the problem, because as @SimonMourier pointed out, they're not equivalent. It's a workaround that fortunately works for me and while it may not work for all cases, it's starting to look like there isn't a better solution.
It's certainly better than my current workaround to make the machine auto login and lock, and then tell my machine to reboot at the end of an RDP session, ensuring I always have an interactive session.
If you use msbuild instead of devenv then it will work
msbuild $sln /t:Rebuild /p:Configuration=Release;Platform=x64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With