I downloaded project from https://github.com/microsoft/BotBuilder-Location , extracted and opened the CSHARP folder using VisualStudioCode. I tried to run the project from terminal using command
dotnet run --project BotBuilderLocation.sln
But I'm getting multiple errors as follows:
D:\InsuranceClaimSolution\BotBuilder-Location-master\CSharp\BotBuilderLocation.Sample\BotBuilderLocation.Sample.csproj(158,3):
error MSB4019: The imported project "C:\Program
Files\dotnet\sdk\3.1.416\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets"
was not found. Confirm that the expression in the Import declaration
"C:\Program
Files\dotnet\sdk\3.1.416\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets"
is correct, and that the file exists on disk.
C:\Program Files\dotnet\sdk\3.1.416\Microsoft.Common.CurrentVersion.targets(1177,5):
error MSB3644: The reference assemblies for .NETFramework,Version=v4.6
were not found. To resolve this, install the Developer Pack
(SDK/Targeting Pack) for this framework version or retarget your
application. You can download .NET Framework Developer Packs at
https://aka.ms/msbuild/developerpacks
[D:\InsuranceClaimSolution\BotBuilder-Location-master\CSharp\BotBuilderLocation.Tests\BotBuilderLocation.Tests.csproj]
C:\Program Files\dotnet\sdk\3.1.416\Microsoft.Common.CurrentVersion.targets(1177,5):
error MSB3644: The reference assemblies for .NETFramework,Version=v4.6
were not found. To resolve this, install the Developer Pack
(SDK/Targeting Pack) for this framework version or retarget your
application. You can download .NET Framework Developer Packs at
https://aka.ms/msbuild/developerpacks
[D:\InsuranceClaimSolution\BotBuilder-Location-master\CSharp\BotBuilderLocation\BotBuilderLocation.csproj]
The build failed. Fix the build errors and run again.
I'm new to dotnet and VisualStudioCode. I tried to search and fix these errors, but I'm not understanding how to fix this using VisualStudioCode. I've dotnet version 3.1.416. There are too many files and too many lines in this project, which are referring to a different dotnet version. Some target files are also not found. Now I'm confused from where to get these missing target files, what to do inorder to retarget this project to my current dotnet version.
Can someone please help?
Related
I am trying to install EMGU using Nuget. I am using Framework 4.8. WinForms. I'm able to install Emgu.CV but when I try installing Emgu.CV.runtime.windows I get an error saying:
"Could not install package 'Emgu.runtime.windows.msvc.rt.x64 19.28.29336'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.8', 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.
One solution on stackoverflow (Emgu error when trying to install emgu.CV.runtime.windows in VC# 2017) says that "the solution is migrating from package.config to package references" but it didn't work in my case. When I changed migrating I get an error when installing Emgu.CV too. The error is "Unable to find fallback package folder 'C:\Microsoft\Xamarin\NuGet'."
After these I tried manually installing Emgu.runtime and copying dll files but I got a problem related to cvextern.dll. It says that the file is not accessible. I tried registering it rgsvr32 it didn't work. So working manually didn't help either.
How am I supposed to install EMGU.
.netFramework version is not compatible with the package that you are trying to install.
1-Uninstall the packages completely from your project. 2-downgrade
your project's .netFramework version from Properties of the project
3-Reinstall the packages.
I am working on a Selenium Automation for a UnitTest Project in Dotnet Framework 4.6.1 and implementing Gitlab CI using a shared runner.
Created the YAML file and used image: mcr.microsoft.com/dotnet/sdk:3.1
The dotnet build command is failing with error message -
/usr/share/dotnet/sdk/3.1.406/Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (sdk/Targetting Pack) for this framework version or retarget your application.
Any suggestion on -
Q1. How I can resolve this error so I can build my project? If I need to install the developer pack what should be the YAML step to install the developer pack for Dotnet 4.6.1?
Q2. If I use msbuild to build the project then the command is not being recognized. Is there any way to use msbuild command?
Note# These build commands are working in my local.
YAML
ERROR
Looking at the image on Docker hub, it doesn't appear to have a 4.6.1 version available. The available images are listed in the "Full Tag Listing" about half way down the page. If the 5.0 tags don't work for you, there's methods to contact Microsoft about that image under "Support" or "Feedback" at the bottom of the page.
https://hub.docker.com/_/microsoft-dotnet-sdk/
Dotnet build fails with error MSB3644 for few project like greatermap (gmap). I encountered this while upgrading my winform application from .NetFramework to .NetCore 3.0
C:\Program Files\dotnet\sdk\3.0.100\Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v2.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [C:\Users\xyz\Documents\External\greatmaps\GMap.NET.WindowsForms\GMap.NET.WindowsForms.csproj]
C:\Program Files\dotnet\sdk\3.0.100\Microsoft.Common.CurrentVersion.targets(1175,5): error MSB3644: The reference assemblies for .NETFramework,Version=v2.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [C:\Users\xyz\Documents\External\greatmaps\GMap.NET.Core\GMap.NET.Core.csproj]
Well, I tried to install developer pack as mentioned in the error. But, then realized v2.0 is way too older. How would i fix this error? or how should i upgrade my v2.0 referred projects?
I have created a C# project (C# 7.0 & .net framework 4.7.2) and also added some unit tests (NUnit 3.11.0).
This code is stored in a Gitlab repo and I can run the tests and build locally. But now I want to automate this via the Gitlab CI. According to this stackoverflow post and a lot of articles on the internet you should create your own runner on a Windows machine.
But most of those answers are already pretty old and the Gitlab CI can now work with Docker images. But then I arrive at my problem. What image should I use for this runner? I've tried microsoft/dotnet-framework and microsoft/dotnet but those didn't work.
The microsoft/dotnet-framework gives the error message: No such image: microsoft/dotnet-framework
and the microsoft/dotnet images doesn't contain the .net 4.7.2 library so it can't be used for a build.
Gitlab CI + Docker image + C# build?
Is it still not possible to create a Gitlab CI runner with a Docker image for a C# build (console application)? Or am I just doing something wrong here?
My current .gitlab-ci.yml
image: microsoft/dotnet-framework
stages:
- build
before_script:
- 'dotnet restore'
app-build:
stage: build
script:
- 'dotnet build'
only:
- master
Update
Do thanks to #Andreas Zita I now have an Image (dsfnctnl/gitlab-dotnetcore-builder:0.15.0). Unfortunately this gives me the same error as the microsoft/dotnet. This is probebly an error in my build script (or so I hope), but I cannot seem to find what it is.
The error:
$ dotnet restore
Nothing to do. None of the projects specified contain packages to restore.
$ dotnet build
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Nothing to do. None of the projects specified contain packages to restore.
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProject.csproj]
/usr/share/dotnet/sdk/2.1.500/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/builds/test/TestProjectTests.csproj]
Build FAILED.
I think if you use .net framework 4.7.2 and you want to build painless, you need Windows with Visual Studio MSBuild.
Maybe it helps: https://medium.com/#n3d4ti/build-net-project-with-gitlab-ci-44e6c3562a8
Mono image is working for me to build the C# application in GitLab.
image: mono:4.4.0.182
stages:
- build
app-build:
stage: build
script:
- MONO_IOMAP=case xbuild/t:Build/p:Configuration="Debug"/p:Platform="x86"
myApp.sln
only:
- master
Platform might be change according to the build configuration like AnyCPU.
We're creating a new Windows application with a WPF interface. For various reasons, we are attempting to make all of the supporting libraries run on net standard 2.0.
So the WPF project, Foo, references .NET Standard 2.0 projects from the same solution.
My problem is with getting the solution to build on the TeamCity build server.
msbuild gives an error when building the solution (works fine in Visual Studio 2017).
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(268,9): error MC1000: Unknown build error, 'Cannot resolve dependency to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' [Src\Foo\Foo.csproj]
If I use nuget to add NetStandard.Library to the Foo project, then I get a different error from msbuild (still works fine in visual studio).
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [Src\Foo\Foo.csproj]
There isn't a projects.json file.
It's running with 15.0 version of msbuild
External Program Failed: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MsBuild.exe (return code was 1)
Starting with a fresh build server solved the problem. I guess there were too many versions of msbuild and visual studio or SDKs or something on the old ones.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(268,9): error MC1000: Unknown build error, 'Cannot resolve dependency to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' [Src\Foo\Foo.csproj]
The error message indicates you are using MSBuild for .NET Framework 4.0 to attempt to compile your assembly.
You should use dotnet msbuild to compile your .NET Standard 2.0 library and do note you need to have the .NET Core 2.0 SDK installed on the build machine.
dotnet msbuild /p:Configuration=Release
A simple way to install the .NET Core 2.0 SDK remotely on a CI server is to execute the dotnet-install script.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore. [Src\Foo\Foo.csproj]
This error indicates your build server has a preview version of the .NET Core SDK on your server that uses project.json format. You will need the .NET Core 2.0 SDK in order to build.