How to set Solution Configuration Build in MSBuild command-line - command-line

I am trying to build my solution using MSBuild in the Command-Line instead of Visual Studio.
So, I have a Solution Configuration Build called "Installer - QA" which will generate the .exe file. However this solution configuration does not have a project configuration with the same name, so it is building all the projects.
msbuild solutionName.sln /p:Configuration="Installer - QA"
From what I understood this Configuration property sets the Project Configuration instead of Solution Configuration, then my project filter does not work.
It's funny because in Visual Studio works, is there a way to know how Visual Studio does?

The solution I've found so far it's to build using "devenv.exe" as the following:
devenv solutionName.sln /rebuild "Installer - QA"
You will need to add the path to devenv.exe in the PATH environmental variable (e.g. "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE").
The only drawback I see in this solution is the need to install Visual Studio IDE at the remote server.
This post helped me to figure out this answer.

Related

Click once Visual Studio include files

I am trying to deploy a project with Visual Studio 2019 click once. In the directory where the program run when I execute setup.exe I want to add some folder with dependent dlls. Is there any automated way to add folders whithin the path where setup.exe runs?

Is it possible to use vscode-car-plugin in Linux to create a .car file?

I use vscode-car-plugin in my local system (Windows 10) with Visual Studio Code to develop wso2-ei projects and it works perfectly. I can generate the deployed file .car with "Build project" in Visual Studio Code or the "mvn package" in a Windows console.
The component of projects (proxies, endpoints, entries, ...) are saved in Git. For testing purpose, we implement CI/CD with Jenkins in the Linux system and the steps are:
Download the code from Git to Linux/path/checkout/project/src/main.
Generate the deployed file .car with command "mvn package"
Deploy the .car into WSO2-EI.
It's in the second step where we have problems because of the way to create paths of "vscode-car-plugin" which add a "\" instance of "/" and it returns the error "File not found".
If I change the /opt/jenkins/pruebas_inigof/Piloto/target/classes/main/synapse-config/local-entries**/**zzcompras_articulos.xslt.xml, the file exists.
I suppose this plugin was created for the Windows system, but I would like to use the same POM and method to generate the .car file and avoid problems in superior environments.
I resolved the problem modifying the plugin which I downloaded from https://github.com/wso2/maven-tools/tree/master/vscode-car-plugin
I only had to add the line in the class: CAppHandler

Visual Studio Code: Is there a way to build and debug in one step?

Is there a way to build a target and debug that target all in one step in Visual Studio Code? This would be similar to the Build before running setup in Visual Studio. I'm running version 1.27.2 on Windows 7 and developing C code.
I already set a default item to build in my tasks.json file, and I have a default item configured in my debug settings. I'm wondering if I can configure VS Code to do both items with one command, or a setting where I can configure my project to build before running/debugging.

How can I fix "build failed, do you want to continue"? In Visual Studio Code

I got an error when trying to debug Java code in Visual Studio Code.
The error is below
build failed, do you want to continue?
I have tried clearing the workspace, but it doesn't work. How can I fix this issue?
The problem was solved.
I resolved this issue by clearing the workspace cache in Visual Studio Code. Here is a link to the relevant page: Visual Studio Code Clean Workspace Directory. I had renamed a number of folders, class names and packages.
Apparently the Red Hat Developer plugin managed to get out of sync. The .classpath file was out of sync with the POM file. Wiping out the workspace cache caused the plugin to recreate project data from the Maven specification. The problem was solved. I am not sure, but if anyone from the Red Hat project reads this, it looks to me like a bug, or deficiency. In any event it can be worked around.
Original answer:
I think Liu Bei was not clear enough. I am experiencing the same issue. I have a project that builds perfectly in Maven and when I launch the debugger in Visual Studio Code this notification appears in the lower right-hand corner of the Visual Studio Code window.
Obviously the "Debugger for Java" extension thinks there is a build problem. However there are no errors reported in the PROBLEMS, OUTPUT, DEBUG CONSOLE or TERMINAL tabs.
The project builds, and packages in Maven just fine and it can be debugged in attach mode which is tedious at best.
There is something going on in Visual Studio Code that's not being reported anywhere that I can find. I suspect the RedHat Visual Studio Code plugin for Java is in the mix, but I need help figuring out how to work around the issue.
I have to say that we are spending way too much time resolving issues with tools and dependencies and not enough time on the app. The project we are working on is intended for open source distribution. The Spring Framework seems ideal for our purposes, but the tooling, not so much. We are not very far into the project and I am already receiving pressure to switch to ASP.NET Core.
I really need a little help...
This didn't work for me, but I found out what did.
First of all, looking at the Java Dependencies plugin gave me a hint that something was out of sync. The name of my application (artifact) did not match the name in the Java Dependencies tree view.
This was fixed by clearing the Visual Studio Code workspaceStorage folder completely!
This folder was in my case located in (Windows 10):
C:\Users\<myuser>\AppData\Roaming\Code\User\workspaceStorage
If you can't find it at this location, simply search for the folder workspaceStorage.
Next press Ctrl + Shift + P (in my case) to open the Visual Studio Code action prompt. Then choose the command:
Java: Open Java Language Server Log File
This will open a log file which is normally not displayed when building your Java code, and will tell you exactly what went wrong with the build.
In my case it was a conflict as I had two AppConfig.java files, one in main and one in test. Maven handles this fine, but apparently the Visual Studio Code Java builder does not.
Obviously these are bugs in the plugins which I will report to the GitHub contributors, but for now we will have to live with a little manual work.
Still I hope this helps all of you frustrated Visual Studio Code Java developers out there.
It worked for me to change the user setting in file setting.json to "java.debug.settings.forceBuildBeforeLaunch": false in Visual Studio Code, which will disable the check before run/debug.
Build failed error in Visual Studio Code
This error occurs because in your workspace folder the other source code has some errors in it.
So create a new folder and make it as a workspace folder and then write your codes in that folder and run it.
I had that error also and it worked for me, so check for yours.
Using OS X, I managed to overcome this problem. You can either access it from your Terminal or simply use a
shortcut (Command + Shift + C).
Select Base System and Library. Look for the Java folder and click on the Java Virtual Machines folder.
Check if is there the actual version of JDK (most up to date). I've noticed that I had two JDK folders one probably inherited from a previously installation and the most up-to-date Java 15. I dragged 'jdk-14' to the waste bin. Enter password, close finder and restart Visual Studio Code.
It works fine now!
For me, the problem was that I created a folder within a folder for arranging my Java program files with the reference to data structures. In the log file, it was showing that the .java file in the inner folder was not on its project's build path.
Just after deleting that folder and completely deleting all the files in the workspace folder manually in the location C:\Users<myuser>\AppData\Roaming\Code\User\workspaceStorage, this problem was solved!
I fixed this problem by doing the following steps:
Step 1: Opening Visual Studio Code settings (bottom left) https://i.stack.imgur.com/xPlkj.png
Step 2: Searching "Java debug" and selecting Java Debugger under Extensions https://i.stack.imgur.com/797M3.png
Step 3: Find Force Build Before Launch and uncheck it https://i.stack.imgur.com/igtRa.png
And you're done!
First of all, check carefully the errors on Visual Studio Code log and try to not get biased by the community common errors. To do this, press Ctrl + Shift + P to open the Visual Studio Code action prompt. Then choose the command:
Java: Open Java Language Server Log File
By doing this you can find the exact exception that is happening. In my case, I had two exceptions:
java.lang.NoClassDefFoundError: javax/annotation/processing/AbstractProcessor
And
java.lang.NoClassDefFoundError: com.demo.myapplication
So, I was biased to think that error was related to the Java version or stuff like that, but it was related to a Lombok extension installed in Visual Studio Code.
In the end, I found this thread and tested this solution and it worked like a charm.
Here is the solution explained by him:
Finally I got it working. The issue is with the additional argument -Xbootclasspath added by the Lombok extension to the java.jdt.ls.vmargs. I figured it out by integrating the Lombok with eclipse and opened the eclipse.ini file for the changes.
I uninstalled the vscode-lombok extension;
I downloaded the lombok.jar (version 1.18.6) file from https://projectlombok.org/download;
In Visual Studio Code, in settings.json, for java.jdt.ls.vmargs key, I added the argument
-javaagent:"PATH_TO_DOWNLOADED_LOMBOK_JAR_FILE"
A last necessary step (missed by the GitHub guy) is to reinstall the Lombok extension.
I had the same problem.
I just downloaded this provided for Visual Studio Code,
Extension Pack for Java.
Click on the link, download and open it. It will automatically configure Visual Studio Code for Java.

CMake VS2008 CE cross compile - change (deployment - remote directory)

Is it possible to change the visual studio (2008) deployment - remote directory setting from within a CMakeLists.txt. The default CMake is using: "%CSIDL_PROGRAM_FILES%\"
The goal I like to achieve is having multiple projects deploy to the same remote directory. All dll and exe files nicely together on the remote machine for debugging purposes.
PS.
Is there a general approach to change VisualStudio settings, I reckon there are other settings needed to be customized.