I added a project reference of my Business Logic project to my console application. I can reference the project and its classes in the code of my console application. Weirdly, when I build the project, the build fails and the classes which referenced says Type is not defined.Has anybody come across an issue like this?
You have to import name space in your console application class where you are trying to use the business logic application class.
I have selected the incorrect target framework .net framework client profile 4.0 where it should be .net framework 4. Issue rectified and now I can build the project.
Related
I m really curious about to know how you core project class can be called into web project, I see there is no reference project called in Project Reference only showing Infrastructure project?
how it is working? I tried multiple time in other project but still showing me in references
Created 3 projects in a solution.
A. Class library targeting .NET Standard Library
Retrieving a database value using System.Data.SqlClient which is added via NuGet
B. .NET Core console application : Referencing project A to display the DB value
C. .NET Framework console application : Referencing project A to display the DB value
Project B works fine when running, but Project C gives below runtime error.
If I add the System.Data.SqlClient in Project:C, then it will start working. Is it mandatory to add dependent NuGet packages of project A to project C?
Also I want to know the reason of different behavior between .NET Core and .NET Framework console applications.
Reproduction of problem here: https://github.com/Arrow7000/SqlProviderTest
I'm fairly new to the .NET world so am having trouble wrapping my head around exactly what the problem is.
I've tried to use the SQL type provider directly in an F# .NET Core project, but had a bunch of problems getting it to work. From what I can tell that's due to incompatibilities between .net core and type providers.
So what I am trying instead is to have the SQL type provider code encapsulated in a .NET Standard project that I can reference from my main Core project.
I've managed to reproduce the problem in a minimal GitHub repo located here which demonstrates both that
the type provider is working in Visual Studio 2019 with IntelliSense, but
despite this I still get a build error when I try to start the Main project
The build error is
Unable to find the file 'C:\projects\SqlProviderTest\SQLStuff\bin\Debug\netstandard2.0\SQLStuff.dll' in any of
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\ref\netcoreapp2.2
C:\projects\SqlProviderTest\Main
C:\Users\Aron\.nuget\packages\fsharp.core\4.6.2\lib\netstandard1.6
Why isn't the project reference simply working as expected? I've tried adding <Private>True</Private> to the project reference but that didn't make any difference
P.S. in case it matters, I'm developing on Windows but the app gets deployed on a Docker container.
I am trying to build a .net core API using MVC, but I am trying to add it to an application that was not build on ASP.NET Core. When I try and configure the interfaces to be used in the core app (Setup.cs) I am not able to reference the interface. When trying reference the solution within the core app, I get the error
"The following projects are not supported as references: [solution name] has target frameworks that are incompatible with the targets in current project.
.NETCoreApp,Version=1.0
.NETFramework,Version=v4.5
What is the best way to be able to reference a .NETFramework project within a .NETCore project?
from comment above I realized it was not possible. I was not able to use the .net standard version in my core app.
I have an issue with ASP.NET V5 RC1 where it won't let me add a reference to a class library (targeting the 4.6 framework) from my web application. When I right click references and select "Add reference" and then select Solution-> Class library, it shows an error that says
---------------------------
Microsoft Visual Studio
---------------------------
The following projects are not supported as references :
- The project XYZ has a target framework that is incompatible or has version higher than the current project and cannot be referenced.
Hopefully I'm just doing something silly, but google isn't helping. I've tried changing the target framework for the class library to no avail. Can anybody tell me what I've done wrong?