Azure bicep Failed to install .NET runtime v5.0. in visual studio code - visual-studio-code

I am running into the error Failed to install .NET runtime v5.0. when using bicep in visual studio code on a windows machine.

I'm not sure why it's not able to find it automatically, but manually specifying the dotnet path in settings.json resolved the problem.
"dotnetAcquisitionExtension.existingDotnetPath": [
{
"extensionId": "ms-azuretools.vscode-bicep",
"path": "C:\\Program Files\\dotnet\\dotnet.exe"
}
]

Related

MSBUILD getting failed with error MSB4062

Getting error while running build task in VSTS devops.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): Error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly \Extensions\Microsoft\SQLDB\Dac\150\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'file:///C:\Extensions\Microsoft\SQLDB\Dac\150\Microsoft.Data.Tools.Schema.Tasks.Sql.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
Use
/p:StyleCopEnabled=false for .netFramework with msbuild
-p:StyleCopEnabled=false for dotnetcore with dotnet publish
MSBUILD getting failed with error MSB4062
According to the error messages and the comments you posted, it seems you are build the the project that developed by Visual Studio 2017, but build it with old Visual Studio on Azure Devops.
To resolve this issue, you can try to install the Visual Studio 2017 on your private agent.
Hope this helps.

Cordova app for Windows, NuGet fails to get correct version of System.Collections.Specialized

I'm tearing my hair out trying to build a windows app using Cordova. The build error I'm getting is:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(377, 5):
error : The package System.Collections.Specialized with version 4.0.0
could not be found in C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\.
Run a NuGet package restore to download the package.
[C:\cygwin64\home\Owner\src\apps\mytestapp-
gen\platforms\windows\CordovaApp.Windows10.jsproj]
In visual studio, I attempt to add the version of the package to the project and I get the following error:
Severity Code Description Project File Line Suppression State
Error Could not install package 'System.Collections.Specialized
4.0.0'. You are trying to install this package into a project that targets
'native,Version=v0.0', but the package does not contain any assembly
references or content files that are compatible with that framework. For
more information, contact the package author.
Can anyone advise how to resolve this?
I've looked at this very old question How can I make my managed NuGet package support C++/CLI projects? but I can't find anything (particually from the VS2017 era) that helps
May be, this helps others to solve the issue:
My Visual Studio 2017 installation must obviously have been damaged when removing the Visual Studio 2015 installation from that same machine. After I performed a repair of Visual Studio 2017 via Visual Studio Installer the isuue disappeared.

How to configure bower in Asp.net project using Visual Studio Code

I create an empty project using Visual Studio Code's terminal. Then I add bower.json and bower_config.bowerrc files then using terminal run the bower update command. The files contains next code:
bower.json
{
"name": "asp.net",
"private": true,
"directory": "wwwroot/lib",
"dependencies": {
"bootstrap": "4.0.0-alpha.6"
}
}
bower_config.bowerrc
{
"directory": "wwwroot/lib"
}
But even I configured it to download files into wwwrooot/lib folder it still install into bower_comoponents folder. How can I resolve that?
P.S. I need to use Visual Studio Code not Visual Studio.
Your bower configuration file should be named .bowerrc (no bower_config prefix).

Qbs setting target machine type

I'm trying to build Qbs example collidingmice on Windows 10 x64 and got the following error message:
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
I tried setting the following in the collidingmice.qbs
qbs.architecture : "x64"
and got the message
'x64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86_64"
which gives the error message;
'x86_64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86"
which gives the error message;
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
Is there a way to set target machine type e.g. to 'x86' or 'x64' in Qbs?
My guess is that you are using an x86 compiler and an x64 Qt, which will not work. How did you set up your profile?
Here's how I fixed the same issue when building an application using the Qbs build system ("Tiled", the game tilemap editor). In my case I am using the Visual Studio 2019 x64 toolchain.
NOTE: This answer assumes that Qt and Qbs are in your PATH.
Open the command prompt
Run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 to initialize VS2019 environment variables in your command prompt.
cd to the directory where your .qbs project lives.
cd myproject
Create a new shadow build directory for your build and cd into it.
mkdir build-myproject
cd build-myproject
run qbs setup-toolchains --detect which should find your VS2019 environments.
run qbs setup-qt --detect which should find your Qt environment (assuming you added to PATH).
run qbs config --list profiles to show the detected toolchain profiles.
Example:
qbs config --list profiles
profiles.MSVC2019-x64.cpp.compilerVersion: "19.25.28614"
profiles.MSVC2019-x64.cpp.toolchainInstallPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64"
profiles.MSVC2019-x64.qbs.architecture: "x86_64"
profiles.MSVC2019-x64.qbs.targetPlatform: "windows"
profiles.MSVC2019-x64.qbs.toolchainType: "msvc"
...
The MSVC2019 x64 profile is named "MSVC2019-x64". Now specify that via qbs property when building your application like so:
qbs build -f ..\MyAwesomeProject.qbs profile:MSVC2019-x64
Building as x86 can be accomplished in a similar manner, as long as an x86 build of Qt is available. Running the vcvarsall.bat batch file with x86 will set up your command prompt to use the VS x86 environment variables.

Visual Studio Team Services ASPNET CORE build failure

I'm trying to setup a build definition for a new ASPNET Core webapp.
The setup of the build definition is exactly this:
Official Docs
The build fails at building the solution with this error:
Issues
Build
File name doesn't indicate a full path to a executable file.
GETSDKTOOLINGINFO (0, 0)
The project is configured to use .NET Core SDK version 1.0.0-preview2-003131 which is not installed or cannot be found under the path C:\Program Files\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
Process 'msbuild.exe' exited with code '1'.
Any guess on how to solve this?
Thanks
Francesco
You need to install the corresponding version of .Net SDK to build agent machine.
You can refer to this article to download .Net Core 1.0.0-preview2-003131 and install it on your build machine.
Assuming you are using hosted build agent. According to Software on the hosted build server, the hosted build server is deployed with the following .NET Framework:
.NET 4.6
.NET 4.5.2
.NET 4.5.1
.NET 4.5
.NET 3.5 SP1
.NET Core 1.0 with Preview 2 Tooling
You may try to deploy an on-premises build agent and install .NET Core 1.0.1 SDK 1.0.0-preview2-003131 to work with VSTS: https://www.visualstudio.com/en-us/docs/build/admin/index#deploy_agent.
If you insist on using hosted build agent, then you need to use version of Microsoft.NETCore.App that is installed in VSTS, for example:
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
In my case, it was just a change in global.config:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
As long as 1.0.0-preview2-003131 is not available on VSO build hosts