I created a shortcut from the application .EXE in Visual Studio Installer, but the resulting shortcut did not have the option of "Run as Administrator" when I right-clicked the shortcut icon.
The application .EXE in Program Files does allow this option on right-click. If I created the shortcut manually from the .EXE (i.e. "Create Shortcut") instead of from the deployment, then the resulting shortcut also has that option.
How to a deploy an application in Visual Studio Installer to include a shortcut that has "Run as Administrator" option enabled on right-click?
I spent ages looking for a solution to this. Amazing, really, as it must be the case for all Visual Studio installer projects.
I'm using Visual Studio 2017 Community at the time of writing and I can't see any option to do this from within the IDE.
Apparently this is an issue with the resulting .msi where the shortcut created is an "advertising shortcut". I'll leave you to discover what you want to know about that in your own time. (Personally, I don't care.)
What you need to do is force the shortcut to be "non-advertising".
This is the better of the two solutions I've found squirreled away in SO. I think it's better because it 1) doesn't include adjusting your installer project for each solution and 2) doesn't involved manually editing the .msi file after every build.
Full credit to the guys on this SO post for this solution, btw. You know who you are. I'm posting because it's not obvious from the question that it will solve this particular problem.
What you do is make a generic change to the msi creation schema file so that the change propagates to all of your future builds. You'll need Orca to make the initial change.
Download the Windows SDK Installer here.
Select "MSI Tools" in the installer.
Install Orca-x86_en-us found in {Installation Folder}\Windows Kits\10\WindowsSDK\Installers.
Find the file "Schema.msi" which is located somewhere like {Visual Studio Program Folder}\Common7\IDE\CommonExtensions\Microsoft\VSI\bin\VsdSchema.
Open "Schema.msi" in Orca.
Copy the folder to the Desktop if it is read only and replace the original after step 9.
Select the "Property" table on the left.
Add a table row with property DISABLEADVTSHORTCUTS and value "1" (true).
Save the file and close Orca.
Rebuild your installer project and (re-)deploy your application.
Enjoy the ability to "Run as administrator"!
A final note: I've found that updates to Visual Studio can overwrite the change you've made, once again removing the "Run as Administrator" context option. So check the msi file after each update.
If you have a manifest, you can require to have administrator privilege, add the following to your manifest
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
see http://msdn.microsoft.com/en-us/library/bb756929.aspx
You can also run any filetype as administrator with the help of the registry, see http://www.howtogeek.com/howto/windows-vista/add-run-as-administrator-to-any-file-type-in-windows-vista/
Related
Using Visual Studio 2017 on Windows 10, I have a WPF application with an installer created using the Visual Studio Installer extension. When I install it on another PC, the application starts but then exits within the same second. Nothing in logs.
If I add a manifest to force admin mode, its starts correct.
If I copy the files to another folder (outside program files) it starts correct.
Apparently the "program files" is restricted or something? Am I missing something in my setup/installer project? Any other ideas more than welcome!
EDIT:
I've tried to create the installer using WIX and then it runs fine. Seems to be some settings in the VS Installer extension.
You can modify the ACLs on the folder in question to allow write access by regular users (not great) or you could write the settings file somewhere else where write permission for users is standard.
There are many ways: Resolve lacking permissions.
There is another, similar answer here.
Adding a couple further links:
WiX and deployment links, various topics.
I've developed an application for Hololens, so the only way I know to install the application in hololens is by visual studio, so I want an application package to be able to install without needing Visual Studio. I tried to follow this tutorial here
"https://learn.microsoft.com/pt-br/windows/uwp/packaging/create-app-package-with-makeappx-tool"
but I can not find these two .appx and .appxsym files.
If anyone knew, I appreciate that.
Maybe you know some steps, but I will go the full way (it's only deploying without visual Studio):
In Unity:
File> Build Settings
Choose Universal Windows Plattform (older Versions Windows Store). Make sure your settings are right (for hololens, sdk enabled...)
hit "Build"
Now you have to select a Folder to build. In my Projects I create just an "App" Folder
Once it is build navigate to this Folder (if it's not opening automatically).
Open the Solution (in the App Folder, not the Unity one)
In the Explorer right Click on the "Project Properties" which are named like your Project and Select "Store>create App Package (or maybe build, i got it on German)"
If you want only the appx File select "no" at the Windows Store question
Select an Output Folder and Version Number (count's up itself, newer numbers will overwrite older versions on Hololens automatically) and for Hololens only select x86 (the others are not needed. Just consume time). Now hit the "create"(again i hope i translate it right) Button.
Apply on Hololens:
Connect the hololens via USB (you can do it with wifi too, but not in our Network, so i never tried)
Open a browser and type "127.0.0.1:10080" so you get access to your hololens
Navigate to "System>Apps" and under Install App select the appx file (in my case under: (myUnityProject/App/AppPackages/myUnityProject/myUnityProject_1.0.0.0_Win32_Master_Test)
First time deploying select the dependencies (Dependencies/x86)
Hit "go" to Deploy (wait until everything is uploaded)
Some Notes:
To build the Apps i needed mvs 2015 installed (just installed), but this was before the Fall creators Update. Now newer Versions (should) work fine. Also I needed to install the windows "buildtools 2015"
https://www.microsoft.com/de-de/download/details.aspx?id=48159
Hope it works and have fun!
I am trying to automate a build process for a C# (vs2008) solution.
The build script is written in a Batch script which I want to change. We use Clearcase as the CM system. I have searched some tools such as MSBUILD, NANT.
Any suggestions which is a better solution like a sample script in MSBUILD and NANT?
I have not seen any sites where MSBUILD and NANT is documented well or any good tutorial about each task description.
Where I can learn MSBUILD or NANT either of them and write script from scratch?
There is a third way which I prefer. You can also use devenv.com. It's faster than NANT, doesn't require NANT bins and works on any machine with VS installed. You also avoid possible errors with MSBUILD (http://support.microsoft.com/kb/964125).
Just use %path_to_devenv.com%\devenv.com "%path_to_sln" /<buildoption> BuildConfig
In my case it's
%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com "C:\Projects\XYZ\xyz.sln" /rebuild Debug
This way it's guaranteed that your project will be build exactly the same way as it's being built in Visual Studio.
EDIT:
Now that we know how how much there is to do, I'll try to give an outline how you can setup the whole system for automated build controll.
Set up your repository (I hope this is already done - tell me if not)
Install and set up Jenkins (https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins) including users, ClearCase-Credentials, plug-ins for ClearCase, MSBuild, etc. (all of them can be found in the Jenkins plug-in interface) - this is the biggest peace of work
Create and set up a new project in the jenkins interface (name, working directory, etc.)
Tell jenkins to use source code management (e.g. subversion module), enter the ClearCase repos to use, set the desired behavior of the source code management
Set a build trigger (I recommend checking the source code management each minute: * * * * *)
Add a build step and select "Build a Visual Studio project or solution using MSBuild" - this option should appear after installation of the MSBuild plugin (https://wiki.jenkins-ci.org/display/JENKINS/MSBuild+Plugin)
Set the path to the .sln file (you have checked it out from your repository)
Add more optional arguments if desired (eg /p:Configuration=Release or Debug or whatever http://msdn.microsoft.com/en-us/library/vstudio/ms164311%28v=vs.110%29.aspx)
Play around untill it works
Btw., I recommend to put all external dlls into your repository.
I'm using Visual Studio 2010 to build a program in C that can operate on a PostgreSQL database.
Everything is fine in VS, no compile errors, everything looks good.
When I click to debug and run, the code compiles, but then I get a pop up that says:
The program can't start because libpq.dll is missing from your computer
I've installed PostgreSQL and added the folder containing all the necessary files to my include and linker paths, but to no avail.
I cannot figure out why I am still getting this message?
Any suggestions?
The answer's surprisingly simple.
The issue you're seeing comes from the compiled application not being able to find the PostgreSQL libraries. The libpq.lib is used to compile the application, and it links to the DLL at run-time. You can either add it to your system wide path, or bundle the DLL with your application. (I'd add it on the development machine, and bundle the redistributable for a installer package.)
To include it in your path try:
Right click on "My Computer" and select Properties
Then Click on "Advanced System Settings".
Click the "Environment Variables" button at the bottom of the dialog box.
It will pop up a dialog with a group box labeled "System Variables". Find the one in the list box that has a Variable name of "Path".
Now, add the path of the PostgreSQL library folder to the path with a ";" separator.
Now logout or reboot. It's imperative that you at least log out of Windows and log back in for the Visual Studio debugger to pickup the additional executable module paths (that Path variable). Ideally, rebooting sends the new system path to all applications in the system at boot time.
If the Path variable has "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" in it, you would add ";C:\Program Files\PostgreSQL\libraries" to make it look like "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\PostgreSQL\libraries".
Be aware that your path will be really long in most cases. Just add it to the end.
Good luck!
I have Win10 64 bit and this worked for me.
Get portable version of HeidiSQL and copy libpg.dll from the archive to the HeidiSQL installation folder on your computer.
Works like a charm.
I have a WPF C# 4.0 Application. I was publishing projects fine before but all of a sudden one particular project starts to not publish. I get the following errors after a successful build.
Error 2 Could not find file 'obj\x86\Release\CSCDemo.exe'. CSCDemo.0
Next error is 'failed to Publish'
I know that CSCDemo.exe is in the Release folder because I checked.
Would Microsoft Visual Studio 2010 Service Pack 1 fix this?
The packager is looking at the obj\x86 folder, not the normal bin\release folder for your exe. I am thinking the issue has to do with either the packager looking in the wrong place or you have changed the project properties for your CSCDemo project. Have you changed it from being an x86 application to x64?
Another thing to try would be a complete rebuild.
I have just suffered from this problem. It seems my Avast Anti-Virus was deleting the file as soon as it was created. I just added my project folder to it's global exclude list and everything worked fine again.
I'm not sure exactly how your development machine can get fouled up this way, but this started happening for several developers in our group too.
After researching it, it appears that the built in build/publish script that Visual Studio (2010 in our case) uses has a flaw in the order that it does things. Most importantly it runs a cleanup on the OBJ directory deleting the target EXE file before the publish step can grab it.
The solution
This is somewhat of a hacky workaround, but it solved the problem for me.
The fix is to copy the file back to the /obj/ folder from the /bin/ folder right before the publish step. Unfortunately there is no way that I know to specify a BeforePublish event through the IDE, so you will have to edit the .vbproj file in a text editor.
Add the followign section just before the final </project> tag.
<Target Name="BeforePublish">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(IntermediateOutputPath)" />
</Target>
change the platform from x86 to Any CPU will help
Build>configuration manager
change the platform against CSCDemo to Any CPU