How to pass different options to cppwinrt.exe - c++-winrt

I have a cppwinrt project created from the visual studio template and I would like to pass different options to cppwinrt.exe to test out what's available in the compiler. Is there a menu in visual studio where I can provide command line arguments, similar to how you can provide arguments to the MSVC compiler from the Configurations Properties in VS2017?

There is no property page available in Visual Studio for configuring cppwinrt.exe command line options. If you're curious, you can simply run cppwinrt.exe from a developer command line prompt (assuming you have a recent Windows SDK installed) and it will provide documentation for the command line options. You can then use these in a custom build rule if you need complete control of the options.
Update:
C++/WinRT NuGet Version 2.0.190605.7 now provides a property page to modify C++/WinRT project properties, including an "Additional Parameters" field for command-line options:

Related

Statically linked WebView2Loader produce invalid binary

We are trying to integrate WebView2 into our Win32 application, and it is working fine when it links to WebView2Loader.dll.lib to load WebView2Loader.dll.
We followed the MSDN instructions to link the library statically, and this has so far failed to work. There are no errors output during the build, and even with diagnostic setting all looks perfectly correct.
However, the executable produced does not have a valid PE header.
We are building an x86 executable, and it is linking with WebView2LoaderStatic.lib from the x86 folder of the WebView2 package, as downloaded with NuGet.
The used environment is:
Visual Studio 2017, with all updates installed, Build Toolset 141, Target Platform is Windows 10, Windows SDK Version is 10.0.17763.0
Update 1: We have discovered that if "Generate Debug Info" in Linker Options is turned off, a valid binary is generated. However, this is not a good solution for us in debug mode, so any ideas that might help would be deeply appreciated. Our temporary solution is to edit the project file to conditionally set the static linkage flag only when doing release builds, and ensure those doesn't contain debug info.

Install Visual Basic in VS2015

I want to install only the visual basic. How can I customize my installation excluding the additional features of VS2015? I have tried the custom installation but I am lost on what is the pre requisite applications needed to make VB projects.
It seems that by default, C#/VB, Web and some Desktop features are included.
Visual Studio allow you to custom this installation. However A Custom installation automatically includes the components that are in a Default installation.
This is from the msdn website.
You can't only install visual basic, sorry.
EDIT :
Even if you must install C#, you can specify your default environment setting to Visual Basic.
I think you just can't because is in the "pack" with c#

Can't access command line after publishing application

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.

Wix Tools from Command Window

Is it possible to use wix commands from the command window? I have the wix 3.6 toolset installed and although the Wix Project is available, it seems that the project template does almost nothing to help you create a project. From my understanding, all the helpful tools are command based and are not accessible from the command window (at least they aren't for me). Am I missing something? It would seem rather unhelpful to have a visual studio project where you have to type all the xml by hand and then leave the IDE to use any of the useful tools.
You can call executables from the command window. For example, to call Heat with the /? param:
Tools.Shell /o /c heat.exe "/?"
Note that I have the WiX Toolset bin directory set in my Path.
You can also create code snippets to speed up entering repetitive xml.

Any way to replace visual studio's usage of msbuild and still get error reporting in the IDE?

Any way to replace visual studio's usage of msbuild and still get error reporting in the IDE? I think I might want to compile in VS with NAnt or Rake or PowerShell, or something that is just as smart but uses a scripting language instead of XML. My build is fairly straight forward -- find all the .cs and compile them and put the dll in a Debug/ or Release/ etc.
I'd like to add a number of other steps that just seem easier from the command line:
Like hit the server to prime certain caches.
Compile with Closure
Minify CSS
Generate some metrics after build (in a certain config)
Run NUnit (or custom) testing framework and send an email
etc....
However, I'd still like to get the "error on line" feed back inside of the IDE. Is this a possibility?
You could write some extension for Visual Studio (Macro, AddIn, Package, etc.) that can augment Visual Studio to let other build tools run. The simplest form is probably just using "Tools\External Tools.." and add your Build Tool there. As long as you format your "build messages" as described here, the should show up the output window as if they were generated by MSBuild.
However, I don't think it is possible (nor desirable, BTW) to completely replace MSBuild in Visual Studio.
Visual Studio not just executes MSBuild.exe and parses it's output. The integration is very tight and a lot of GUI aspects rely directly on the content of the MSBuild file.
For example, when you change some project properties in the Visual Studio UI, the changes are (eventually) written to the MSBuild file of the project.
Also, there are some performance improvements, for example Visual Studio "replaces", so to say, the call of csc.exe (the C# compiler) from an MSBuild file by using an in-process compiler, which safes some compile time, because less external processes need to be launched (also described in the above mentioned document)
While all this, from a architectural point of view, is quit likely wrapped and encapsulated by some "interfaces" inside Visual Studio, I haven't yet found a way to have those "interfaces" implement something else that, for example, uses NAnt behind.
Anyway, I think even if technically possible, it would not be technically feasible.
For rake, check out Rake Runner extension. You can run the rake tasks from the solution explorer and check the errors and other output in the Output pane. I have little experience developing vs packages so if anyone want to help, the project is open sourced here.