Jetbrains Rider: [MSB4057] The target "build" does not exist in the project - asp.net-core

When I create solution in Jetbrains Rider EAP 21 I get "(with missing packages)" error in Solution Explorer window.
Then, I try to build project and get [MSB4057] error.
Despite this, I can run the project through Terminal:
dotnet restore
dotnet build
... and get following information:
Hosting environment: Production
Content root path: *path*
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
dotnet --info command result:
.NET Command Line Tools (1.0.3)
Product Information:
Version: 1.0.3
Commit SHA-1 hash: 37224c9917
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.3

I've resolved a similar problem by changing the MSBuild version in Settings > Build, Execution, Deployment > Toolset and Build > Use MSBuild version.
I've selected the MSBuild located in the Rider install directory.

I recently started receiving such errors in many of my projects. Initially I believed that it was because of Rider's version and rolled back, but instead, it was a problem with the latest MSBuild from the Visual Studio Installation (I use Windows).
The solution for me was to go to File | Settings | Build, Execution, Deployment | Toolset and Build and then tweak the Use MSBuild setting. By default, Rider used the MSBuild that was installed alongside Visual Studio. I changed it to use the MSBuild version installed with Rider instead and the problem went away. The same solution is also discussed in Jebtrains's bug tracking system

The problem was resolved by installing new version of Mono from official site

Related

Cannot build Python.NET Python.Runtime in Visual Studio from master, or via setup.py

I tried to "Build Solution" from Visual Studio 2019, since the Python.NET project comes with a .sln VS Solution file
However, it skipped the Python.Runtime build which is what I'm interested in:
1>------ Skipped Build: Project: Python.Runtime ------
Furthermore, the other 4 builds had an error:
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\NuGet\16.0\Microsoft.NuGet.targets(186,5): error : Your project file doesn't list 'win-x64' as a "RuntimeIdentifier". You should add 'win-x64' to the "RuntimeIdentifiers" property in your project file and then re-run NuGet restore.
Alternatively, when running python setup.py following instructions on https://github.com/pythonnet/pythonnet/wiki/Installation#github-installation-from-master-branch, I ran into another error from not being able to find Windows Kits installed roots. Have been looking around for answers and tried different versions of Python, .NET Core, .NET etc. to no avail. I detailed it in https://github.com/pythonnet/pythonnet/issues/1272
Environment
Pythonnet version: 3.0 (ongoing, latest master branch ending at c81c3c3)
Python version: 3.7.9
Operating System: Windows 10, 64bit, WinPE
I just loaded pythonnet.15.sln instead of pythonnet.sln and was able to build the DLL file.
Although I'm still not sure why pythonnet.sln didn't work for me, does "15" refer to the VS version? The regular sln was being used in this screenshot from a talk https://youtu.be/P7Or7XzeIno?t=1163

npm cannot find SDK version from global.json

I'm in the thick of trying to get up-to-speed on asp.net core / npm / react using this as a base project template:
https://github.com/jonmcquade/aspnetcore-react-redux#local-no-docker
I originally ran into troubles once trying this command:
dotnet build -c Release -o ./app
The error I was seeing:
A compatible SDK version for global.json version: [2.1.0] from
[global.json] was not found Did you mean to run dotnet SDK commands?
Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
I had the specific versions in the documentation installed and I have installed the latest versions, both x64 and x86 platforms.
I now also get this error running the npm install command or the dotnet --version command, yet I have SDKs installed.
It feels like the machine configuration has become broken somehow. I seem to have gotten into a bit of a version pickle trying to get the dotnet build command working and now even NPM isn't working.
Global.json is:
{
"sdk": { "version": "2.1.0" }
}
And the .csproj file contains:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RuntimeFrameworkVersion>2.1.0-preview1-26216-03</RuntimeFrameworkVersion>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<IsPackable>false</IsPackable>
<AssemblyName>FlightSearch</AssemblyName>
<RootNamespace>FlightSearch</RootNamespace>
<ApplicationIcon>ClientApp\favicon.ico</ApplicationIcon>
<Authors>Jon McQuade</Authors>
<Company>ACME Freelancing, Inc.</Company>
<StartupObject></StartupObject>
<Product>Flight Search</Product>
<Description>ASP .NET Core 2.1 MVC SPA with React and Redux</Description>
<RepositoryUrl>http://github.com/jonmcquade/aspnetcore-react-redux</RepositoryUrl>
<PreserveCompilationContext>true</PreserveCompilationContext>
<TypeScriptToolsVersion>2.8</TypeScriptToolsVersion>
<OutputType>Exe</OutputType>
<Version>2.1</Version>
</PropertyGroup>
What am I missing to get this working?
Are there some machine configuration issues that I can check? Maybe environment variables? I've tried running a repair using the installers but this doesn't address the issue.
The global.json specifies the SDK version of .NET Core that is being used to build your application. This has little to do with the .NET Core Runtime version that you want to run your application with.
Your application is a netcoreapp2.1, so you are running the .NET Core 2.1 Runtime. The earliest SDK Version for that is 2.1.300.
Since that is the latest .NET Core version, you actually don’t need to use a global.json at all: Just delete the file from your project and the tooling should use the latest version which is 2.1.300-rc1 on your machine.
If you're running into this issue on OSX you can fix the issue thusly:
which dotnet
ls + the output from the previous command
You should now see something like:
/usr/local/share/dotnet/dotnet
The directory that has your dotnet binary should also have a directory called sdk, so for the above example you can run ls /usr/local/share/dotnet/sdk, which should output a directory with your current version number. In my case that is 2.1.403 (there may be a better way to get the version number, but I was unable to run dotnet --version without specifying the correct sdk)
If I now open the global.json file in my app's root directory and change the sdk version to "2.1.403-osx-gs-x64", I should now be able to run dotnet command such as dotnet run from within my project.
Just make sure the required SDK version is installed in your machine. On your error, it's .NET core 2.1.0. You don't need the global.json file anymore.

ASP.NET Core 1.1 Development on RedHat Enterprise Linux 7.3

I'm have an an ASP.NET Core application that was created using Visual Studio 2017 on Windows 10. It works as expected running the following commands
cd src
dotnet restore
dotnet build
cd Hello.Portal
dotnet run
See build.cmd in the repository for more details.
My next objective is to create a build.sh for RHEL 7, which would end up with an RPM (but that is outside the scope of this question). To prepare for that I did the following:
Create an RHEL 7.3 virtual machine in VMware Workstation
Followed the instructions to install dotnet core 1.1 in the VM.
I then ran the following commands on Windows 10 to create a self-contained deployment.
dotnet restore --runtime rhel.7-x64
dotnet publish --framework netcoreapp1.1 --runtime rhel.7-x64
I then SFTP the output over to the VM and the application works as expected.
I then cloned the GIT repository to the RHEL VM and then ran the following commands, assuming that it would work the same way it did for Windows.
cd src
dotnet restore
dotnet build
However it failed with the following errors:
[werners#localhost src]$ dotnet restore
warn : The folder '/home/werners/development/hello/src' does not contain a project to restore.
[werners#localhost src]$ dotnet build
Couldn't find 'project.json' in current directory
[werners#localhost src]$
This looks rather suspicious. So I logged out and logged back in and the ran the following commands:
[werners#localhost ~]$ scl enable rh-dotnetcore11 bash
[werners#localhost ~]$ dotnet --version
1.0.0-preview2-1-003176
On Windows, the version returns the following:
S:\hello\src>dotnet --version
1.0.3
So it looks like rh-dotnetcore11 doesn't have the latest released version of .NET core command line.
To validate, I ran the following as root.
[root#localhost ~]# yum install rh-dotnetcore11
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Package rh-dotnetcore11-1.0-1.el7.x86_64 already installed and latest version
Nothing to do
What instructions does one follow to use Red Hat Enterprise Linux 7.3 to build, test, run and publish ASP.NET Core application that was created with Visual Studio 2017? .
So it looks like rh-dotnetcore11 doesn't have the latest released version of .NET core command line.
It doesn't. The original release of .NET Core 1.0 had an RC version of CLI (or the SDK, if you will). This was packaged as rh-dotnetcore10 (and later an updated version was rh-dotnetcore11).
Due to compatibility requirements, RHEL packages can not break the command line interface and API.
The 1.0 SDK changed how the command line behaves and the project format; as such it was not suitable for inclusion into RHEL since it would break people's existing workflow and require migration from project.json to csproj.
As such, the RHEL packages contain the latest APIs (corefx and/or coreclr) but the older RC-era SDK.
What instructions does one follow to use Red Hat Enterprise Linux 7.3 to build, test, run and publish ASP.NET Core application that was created with Visual Studio 2017?
Unfortunately, there's no good path forward right now. Some options include:
Using an upstream install of dotnet, something which won't be supported by Red Hat since it's not the official Red Hat package: https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh
Use the RC version of the SDK on Windows, Visual Studio 2015 (2017 doesn't support project.json) and rh-dotnetcore11 on RHEL.
Wait a bit for 2.0 (hopefully releases soon) which should have the new SDK since Red Hat does not aim for compatibility between 1.0 and 2.0.

monodevelop won't compile VB code

I wanted to have a look at monodevelop, thinking about possible moving in-house projects written in .Net from Windows to Linux.
I installed mono-complete 4.0.2 and monodevelop 5.9.4 on a clean Ubuntu 14.04 VM, I assume those are the latest/current versions.
Now C# works, but I can't get it to compile any VB code.
Any new VB project I create first refuses to load.
Quickly found (Google) that the mono VB compiler doesn't support framework 4 or higher yet, but the project template generates projects targeted at 4.5.
After I manually edit the project file to target 3.5, 3.0 or 2.0, the projects load (this works for console as well as GTK projects).
But when I try to compile it then, no own code added yet, just the auto-generated base code, it just fails without any error messages.
Build output:
Building: VbHelloConsoleWorld (Debug|x86)
Build started 7/3/2015 10:42:20 AM.
__________________________________________________
Project "/home/luc/projects/VbHelloConsoleWorld/VbHelloConsoleWorld.vbproj" (Build target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: x86
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Done building project "/home/luc/projects/VbHelloConsoleWorld/VbHelloConsoleWorld.vbproj".-- FAILED
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.0438100
---------------------- Done ----------------------
Build successful.
Am I still missing some dependencies? Other stuff that must be fixed before a VB project will work?
For some reason building VB.NET with MSBuild does not work.
To workaround this you can disable the use of the MSBuild build engine. Go into project options, Build - General and uncheck Use MSBuild build engine. Then the project should compile and generate an output assembly.

MSBuild error - Solution is of version 12.00 which is not currently supported

I have a Build server which has TFS 2010 Build Service installed. I have 2 Build Agents and 1 Controllers configured. One of our projects have been converted to Visual Studio 2012.
I found out that .NET framework 4.5 comes with new version of MSBuild which is version 4.5.
I installed .NET framework 4.5 on the Build Server because prior to installing it every time the project was built I kept getting the following error:
"Solution is of version '12.00' which is not currently supported".
After installing .NET 4.5, I still run into the same issue.
How could I go about resolving this?
Do I have to configure the Build Agent to use the new MSBuild 4.5 in order to build this particular project or do I set something in the projects solution file itself? If so how?
I would really appreciate if somebody could assist me with this please?
Try install vs2012 on the build server, while i don't believe it's strictly needed it's the easiest way to get all the requirements installed.
We have installed VS2012 on the build agent. Interestingly when I RDC to the build agent and then run msbuild from the command line everything works fine. So the issue looks like it happens before we even get to MSBuild.