First, let me explain the problem that causes this question.
If I create a new project using dotnet new and specifying a random project name with -n arg, then after doing dotnet restore - dotnet build from default bash terminal -> the final output name is always React + .output_type. Like:
/bin/Debug/netcoreapp2.0/React.dll
I don't specify any additional arguments with dotnet commands. And looks like it doesn't matter what type of project to select: I have tried with console and webapi.
But I have found that if I open the project in VS Code and do the same dotnet build command from VS Code terminal (that is also bash) -> the output name is correct and equal to the project_name+.output_type.
So before I thought that output name is always taken from .csproj file name during building. But now it looks like something could override this behavior: different terminals - different env settings, etc.
Cause output name contains React I am blaming the react cli tooling, but this doesn't help me with identifying the reason of name-override.
I did dotnet --info from both terminals and output was the same:
.NET Command Line Tools (2.0.0)
Product Information:
Version: 2.0.0
Commit SHA-1 hash: cdcd1928c9
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.0.0/
Thanks to #MartinUllrich, I have found that $TARGETNAME variable overrides the project name. Removing variable fix the problem:
> unset TARGETNAME
Related
I am building single file executables for both MacOS (osx-x64) and Windows (win-x64).
My command line is:
dotnet publish --nologo -r osx-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true
When moving to .Net 5, I am now getting this error:
/usr/local/share/dotnet/sdk/5.0.100-preview.7.20366.6/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(142,5):
error NETSDK1097: It is not supported to publish an application to a
single-file without specifying a RuntimeIdentifier. You must either
specify a RuntimeIdentifier or set PublishSingleFile to false.
So I decided to add the RuntimeIdentifier section:
<RuntimeIdentifiers>osx-x64;win-x64</RuntimeIdentifiers>
It turns out that this needs to be in every sub-project.. a bit annoying but ok.
But now, it doesn't work:
Applications published to a single-file are required to use the application host. You must either set PublishSingleFile to false or set UseAppHost to true.
Additionally, if I add all on the command line:
dotnet publish --nologo -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:UseAppHost=true /p:RuntimeIdentifier=osx-x64 -r osx-x64
I get the same error. It looks like the config on the dotnet command line gets ignored.
Adding the runtime identifier to all the project files, yields:
error MSB6006: "dotnet" exited with code 1.
which doesn't really say anything.
My question is:
has the behavior changed with .NET 5 (I can't find anything on the topic), or is the preview that is broken?
I am completely new to Scala and SBT. I have downloaded the .tgz archive for SBT 1.3.2, extracted it and added its bin directory to my PATH on Ubuntu 18.04.
I am following the official Getting Started guide, which gives a command to create a simple project. It is supposed to run like that:
$ sbt new sbt/scala-seed.g8
....
Minimum Scala build.
name [My Something Project]: hello
Template applied in ./hello
Instead, it asks me for credentials:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username:
I have no idea what to enter. I can't even try to guess, since I can only enter one character before it asks for a password. If I enter one character again, I get the username prompt again. This is the output after pressing two keys:
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username: Password:
Username:
I just want to setup a basic project. What am I doing wrong?
If you get sbt new user/some.g8 asking for the Username: then you know that you have typed the template path e.g. user/some.g8 incorrectly so it doesn't exist as a g8 template.
Please check that you have to correct template path and try again.
Even I got the same error when I tried to create a new project following the instruction from https://docs.scala-lang.org/getting-started/sbt-track/getting-started-with-scala-and-sbt-on-the-command-line.html using sbt cli.
I ran the command as below,
sbt new hw/hello-world.g8
Following the above command I was prompted for suername and password. Then I ran it again as
sbt new scala/hello-world.g8
This time the project was successfully created.
Output:
hello-world.g8
[info] welcome to sbt 1.3.13 (Oracle Corporation Java 1.8.0_261)
[info] set current project to scala (in build file:/C:/scala/)
[info] set current project to scala (in build file:/C:/scala/)
A template to demonstrate a minimal Scala application
name [Hello World template]: hello-world
Template applied in C:\scala\.\hello-world
So the hw in the command "sbt new hw/hello-world.g8" is not correct and it has to be only "sbt new scala/hello-world.g8".
In the first, working example you have scala hyphen seed.
$ sbt new sbt/scala-seed.g8
....
In the second non-working example you have scala underscore seed.
$ sbt new sbt/scala_seed.g8
[info] Set current project to code (in build file:/home/user/code/)
[info] Set current project to code (in build file:/home/user/code/)
Username:
I'm installing dotnet core on Linux ARM64 using tarball as explained here. After installing I followed the suggestion to set DOTNET_ROOT=$PATH:$HOME/dotnet. However global tools fail with A fatal error occurred, the required library libhostfxr.so could not be found.
I fixed by changing the env variable to DOTNET_ROOT=$HOME/dotnet.
Is this a bug in the docs ?
Yes, this appears to be a bug in the documentation. The code which interprets DOTNET_ROOT does not split the string on :. DOTNET_ROOT should be set to an absolute file path which points to the directory containing the dotnet executable. If dotnet is on your PATH already, you can set it like this in bash/zsh.
export DOTNET_ROOT="$(dirname $(which dotnet))"
came across this problem while working on porting .net libraries from Windows to Raspberry PI. On the Raspberry the .net core 3.1 installs in /opt/dotnet, and that's where DOTNET_ROOT ought to point at:
export DOTNET_ROOT="/opt/dotnet"
This should eliminate the "fatal error occurred. The required library libhostfxr.so could not be found." error when attempting to run portable code using the 'dotnet' command on the RPI
I was getting an error trying to execute the dotnet ef from the EF cli global tools install.
Added this to the bottom of my /home/<user>/.bashrc worked for me.
# User specific aliases and functions
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
Then the dotnet ef command worked correctly.
I had to add this to my ~/.zshrc
export DOTNET_ROOT=~/.dotnet
export PATH=$PATH:$DOTNET_ROOT
I found that I had different locations for different sdk/runtime versions. One was installed at "/home/{username}/.dotnet" and the other at "/usr/share/dotnet".
I found a post stating the default DOTNET_ROOT is "/usr/share/dotnet" and errors showed dotnet command was executing this location. I copied all files from "home/{username}/.dotnet" to "/usr/share/dotnet" with rsync.
sudo apt install rsync;
sudo rsync -a /home/{username}/.dotnet/ /usr/share/dotnet
I'm trying to set up autobuild appveyor on my Qt project.
My app is using qt5.10.1, with qml and openSSL features.
I'm lost... I didn't know from where to start :/
# 1:
I found some examples of .apveyor.yml config files, but they are all using mingw32 compilator which do not allow me to use qml webview module (why)... I didn't find what I have to write in my appveyor config file to compile my app with msv2017 where is the compilator ?
Actually, my appveyor.yml looks like that (I try to do as QtCreator is doing on my local computer but it's not working)
image: Visual Studio 2017
branches:
only:
- master
install:
- set QTDIR=C:\Qt\5.10.1\msvc2017_64
- set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
build_script:
- qmake app/QRegovar.pro -spec win32-msvc
- qmake_all
- C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
deploy:
- provider: GitHub
artifact: C:/projects/qregovar
draft: true
prerelease: false
on:
branch: master
appveyor_repo_tag: true
And it's failling with the following error:
Build started
git clone -q --branch=master https://github.com/REGOVAR/QRegovar.git C:\projects\qregovar
git checkout -qf 7357eb2adab349c4de9e0b346dc99027964ea5a5
Running Install scripts
set QTDIR=C:\Qt\5.10.1\msvc2017_64
set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
qmake app/QRegovar.pro -spec win32-msvc
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
Command exited with code 3
# 2:
I'm also wondering if appveyor is using qt static build ? As I would like to create "ready to use" package for the user ?
I'm using CMake, but I guess the trick is to setup 'cl' compiler into PATH, so qmake is able to find it.
In sample appveyor scripts the main build script is '.\qtmodules-travis\ci\win\build.bat'. This script will check/use AppVeyor matrix-defined variable for platform (line 7+) and then the script define VC_DIR etc.
And on the end is invoking script referred by you 'build-msvc.bat' where is invoked:
call %VC_DIR% %VC_VARSALL% || exit /B 1
QtCreator will do the setup for you (you are using Kits...)
When you are building in clean command line, you should do 'vcvarsXXX.bat call yourself before 'qmake' call.
In my opinion AppVeyor doesn't trigger this call for you, because developer may wish different build env. setup (e.g. x86, x64, arm etc.). It's your choice. Actually this is the hint as well when you start 'Qt command line' on your PC from start menu (it call 'C:\Qt\5.11.0\msvc2017_64\bit\qtenv2.bat' shell setup script)
I'm French, and like to have the Windows UI in French, but all my dev tools in English.
The dotnet CLI tool displays its output in French, and I'd like to force it to English. Is it possible?
You can use the DOTNET_CLI_UI_LANGUAGE environment variable to override the language used by the dotnetCLI:
> set DOTNET_CLI_UI_LANGUAGE=en
> dotnet --help
…
[english content]
For unix-like system (Mac OS X, Linux)
set DOTNET_CLI_UI_LANGUAGE=en
dotnet --help
For Windows
setx DOTNET_CLI_UI_LANGUAGE en
Goto "dotnet-install-directory\sdk\sdk-version" (For example C:\Program Files\dotnet\sdk\3.1.102 in windows for dotnet version 3.1.102)
Delete folder of your language
for example, delete fr because your dotnet show French.
delete zh-Hans and zh-Hant if your dotnet show Chinese.
To set DOTNET_CLI_UI_LANGUAGE environment variable please use:
DOTNET_CLI_UI_LANGUAGE=en in cmd.exe
$Env:DOTNET_CLI_UI_LANGUAGE = "en" in PowerShell
Worked for RU-language too.
setx DOTNET_CLI_UI_LANGUAGE en - partially change the cli language.
And delete or rename folder of your language in "dotnet-install-directory\sdk\sdk-version" that you can get via dotnet --info - changes finally the language to English.
I tried to Martin's answer,but it did not work
After that, i tried followings, it needs to work
Run the command setx DOTNET_CLI_UI_LANGUAGE en
Go to location where dotnet is installed Go to
"dotnet-install-directory\sdk\sdk-version" (For example C:\Program Files\dotnet\sdk\3.1.102 in windows for dotnet version 3.1.102)
Delete folder zh-Hans and zh-Hant