I'm developing a Visual Basic application using Visual Studio. My application worked fine with command line arguments until I compiled a "Publish" the first time. Now if I try to run the executable file generated in the debug folder I get a System.IndexOutOfRangeException thrown. If I try to run it inside Visual Studio I get this warning:
The current project settings specify that the project will be debugged with specific security permissions. In this mode, command line arguments will not be passed to the executable. Do you want to continue debugging anyway?
And then the code run without errors, but it does not create a new .exe file in the debug folder.
What have happened? How can I fix this problem? My code worked just fine until I tried to "publish" it. I haven't changed a single line.
The "Publish" feature in Visual Studio uses ClickOnce deployment technology. There's a pretty good overview of ClickOnce, and how it differs from MSI deployment, at https://msdn.microsoft.com/en-us/library/142dbbz4(v=vs.90).aspx.
The MSDN topic "How to: Retrieve Query String Information in a ClickOnce Application" at https://msdn.microsoft.com/en-us/library/ms172242(v=vs.90).aspx confirms that "It is not possible to pass command-line arguments to a ClickOnce application. If you want to supply arguments to the application, you must deploy it over the Web and supply query string parameters in the URL."
You can create still create File Associations for a ClickOnce application, but it requires specific configuration steps as well as modified code. The following blog posting walks you through this:
http://blogs.msdn.com/b/mwade/archive/2008/01/30/how-to-add-file-associations-to-a-clickonce-application.aspx
Overall, unless you have a specific need to use ClickOnce, I would suggest sticking with XCopy or MSI deployment.
Related
I've got a solution that builds locally on my developer box, and I've tried it using remote desktop on my TFS build server, which is server, controller, and agent. What is baffling is that when I queue a build, it fails, with this message in the log file.
Considered "..\..\..\..\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.Coverage.Analysis.dll", but it didn't exist.
Part of what is so confusing is that If I navigate to that location, I can see the file that I need.
In further testing, I went to the build source folder and loaded the solution there. It shows that it can't located the reference. If I just remove the reference, and re add the exact reference again, it builds.
If you have a better title or want further clarification just ask or make suggestions.
I have a console application that dies very quickly, and upon inspecting the code, I can't tell exactly where it'll die (I've basically narrowed it down to a 10 line radius) so that I further debug it.
For reasons I won't go into, I can't execute the process from VS (I have the binaries, source, and pdbs though, but I can't build outside of the build server's environment), and would like to attach to the process... but when I start the process, it dies much sooner than I could ever hope to refresh the attach to process dialog.
Ideas?
One possibility for doing this is to use any existing Visual Studio project and specify the application as the application to debug. The steps (in Visual Studio 2010) are:
Go to the project properties.
Choose Debugging (under Configuration Properties)
Edit the Command and fill in the path to the binary
Then it should be possible just to start debugging (e.g., F5 or Debug\Start Debugging).
Another option that might be a bit quicker if you have the debugging tools installed would be to use WinDbg.exe. It would avoid needing to use a Visual Studio project. You can open the executable, specify command line parameters, etc. and then type g<ret> in the command line to fire it up.
I have been trying to achieve ClickOnce deployment using MSBuild scripts, but I could not find any resource on how to copy the files after generating the manifests.
Since we need to script baby steps in case of mannual deployment, which Visual Studio does for us if we use the wizard, I'm not able to do it, since I'm new to both MSBuild and ClickOnce.
Is there a resource where I can find detailed information on how to script the entire ClickOnce deployment for multiple environments, increment version number using TeamCity's BUILD_NUMBER and sign the assemblies?
All that you see Visual Studio doing is done by MSBuild (except creating/updating the "publish.html"). This is true for any environment, if you meant configuration. To publish using MSBuild, all I do is execute the following at Command Line:
%SystemRoot%\Microsoft.Net\Framework\v3.5\msbuild <myProjectName> /p:Configuration=Debug; /t:publish
This gives me a Development environment Build (we use the default Debug configuration for Dev). For QA I just replace the "Debug" part in the above command to "Release".
Can someone point out any tutorials that help build windows services using msbuild.
Requirements :
- Should not use the csproj file
- Output should be the same as the publish option in Visual Studio
Updated question:
We have a project of type windows service in our solution. In this windows service, we are referencing a couple of libraries that reside on a different system (one of them is not strongly named). This solution also contains other class libraries and websites/web-apps.
I am trying to write a custom build that outputs a xcopy deployable version of the website, and a deployable version of the windows service. When I say windows service, it shows up on the Control Panel -> Services MMC.
The website build was easy via msbuild...however I am struggling with the windows service build. Until now, my fellow developers were using the right-click on the project file ,and click publish to publish the windows service. This generates a setup.exe file that helps the admins to deploy the service.
So, now here is my question:
I want to use msbuild to build my windows service.
I do not want to directly use the .csproj file in conjunction with msbuild to build the service.
The output my build file generates should match the output from the "publish" option (*the publish option generates a setup.exe file*)
In general, "the publish option" under the covers just runs a build with /t:Publish, i.e., it triggers a different target to the normal default 'Build' one.
Can you tell us more of what you are looking for, as opposed to not looking for?
Are you looking to generate an MSI? (If so, you definitely won't be using MSBuild if you're using the built-in .vdproj system - but be careful - this means having to put VS on a build server)
I have a Visual Studio solution file (.sln), with several projects (VB.NET and C#, .vbproj, and .csproj files, respectively), and I have a Windows application, and I use ClickOnce to publish it.
Now, I need automate the Publish option using MSBuild or another good solution (cmd, VBScript, or BAT scripts).
How can I do it?
Well, ClickOnce uses MSBuild to publish itself. Therefore I would recomment to use MSBuild for your build-automation. See the reference on MSDN.
The first step is easy. You just run MSBUild with 'Publish'-target from the console. The settings made in Visual Studio are applied.
However, there are some tricky bits. For example, when you run it from the command line, the version number isn't increased. In my project I've solved this by passing the version-number from the build script.
Another tricky-part is when you want to run the build script on your build-server without Visual Studio installed. There you might have to copy some to make it work.