All Questions

Filter by
Sorted by
Tagged with
2893 votes
13 answers
426k views

What are the correct version numbers for C#?

What are the correct version numbers for C#? What came out when? Why can't I find any answers about C# 3.5? This question is primarily to aid those who are searching for an answer using an incorrect ...
340 votes
8 answers
192k views

Equivalent to AssemblyInfo in dotnet core/csproj

Since dotnet core moved back to the .csproj format, there is a new autogenerated MyProject.AssemblyInfo.cs which contains, among others: [assembly: AssemblyCompany("MyProject")] [assembly: ...
hultqvist's user avatar
  • 18k
271 votes
15 answers
228k views

Non-nullable property must contain a non-null value when exiting constructor. Consider declaring the property as nullable

I have a simple class like this. public class Greeting { public string From { get; set; } public string To { get; set; } public string Message { get; set; } } Strangely I get the ...
VivekDev's user avatar
  • 23.2k
156 votes
2 answers
8k views

If (false == true) executes block when throwing exception is inside

I have a rather strange problem that is occurring. This is my code: private async Task BreakExpectedLogic() { bool test = false; if (test == true) { Console.WriteLine("Hello!"); ...
George's user avatar
  • 6,699
148 votes
21 answers
104k views

Auto Versioning in Visual Studio 2017 (.NET Core)

I have spent the better part of a few hours trying to find a way to auto-increment versions in a .NETCoreApp 1.1 (Visual Studio 2017). I know the the AssemblyInfo.cs is being created dynamically in ...
Jason H's user avatar
  • 5,086
138 votes
5 answers
231k views

Where is NuGet.Config file located in Visual Studio project?

I am wondering where is NuGet.Config file located in Visual Studio 2017 project? I tried to create my own NuGet.Config file in the root of the project, but I didn't find any new repositories (NuGet ...
Mohammed Noureldin's user avatar
112 votes
32 answers
88k views

Project file is incomplete. Expected imports are missing

After format my computer I reinstalled Vs 2017 V 15.6.3 and install ASP.Net Core SDK from Microsoft 2.1.4 But when I create new asp core application VS failed with error "Project file is ...
Majd Albaho's user avatar
  • 1,331
102 votes
5 answers
55k views

error CS8773: "Feature 'global using directive' is not available in C# 9.0" after downgrade from net6.0 to net5.0

I have a project that was initially created for .NET 6 but then I needed to downgrade it to .NET 5. I changed Target framework in Project Properties and tried to compile. As a result I received a ...
Yuriy Gavrishov's user avatar
100 votes
4 answers
54k views

AssemblyVersion using * fails with error "wildcards, which are not compatible with determinism?"

I can't use * in assembly version; when I do I get the following compilation error: The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards ...
Lucyper's user avatar
  • 1,059
96 votes
4 answers
58k views

Package version is always 1.0.0 with dotnet pack

TLDR: Where is dotnet pack pulling the version information when it creates the nuget package for an assembly? I have a library, that I had transitioned from a .NET 4.6.1 project to a .NET Core ...
Alexander Matusiak's user avatar
75 votes
32 answers
105k views

Unable to start process dotnet.exe

I am attempting to setup a new work space and transfer all of my projects from my old computer to the new one. However, I am getting this error when I try to run IIS Express: Unable to start ...
marino-mcgalla's user avatar
68 votes
3 answers
15k views

No UseDatabaseErrorPage() extension method in Net Core 3.0

I have created Net Core 3.0 app and following code that worked in 2.2 now is not. app.UseDatabaseErrorPage(); Looks like in 3.0 class DatabaseErrorPageExtensions does not exist within Microsoft....
Levvy's user avatar
  • 1,130
64 votes
16 answers
141k views

Failed to bind to address (already in use) error with Visual Studio Mac API

I'm attempting to create a Web API via .Net Core. I'm just using the boilerplate ValuesController as a Hello World. When I run the project, I get the following error: System.IO.IOException: "Failed ...
ChickensDontClap's user avatar
64 votes
3 answers
44k views

Should GetEnvironmentVariable work in xUnit tests?

If I set environment variables for a .Net Core web project in Visual Studio 2017 using the project properties page, I can read the value of the variable using Environment.GetEnvironmentVariable; ...
Eric's user avatar
  • 2,240
56 votes
8 answers
98k views

The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found

I am using Visual Studio 2019 Version 16.3.7. I assume it is the latest update. When I try to compile a basic .NET Core 2.2 console application: ...I get the following error: It was not possible to ...
Allan Xu's user avatar
  • 8,542
54 votes
2 answers
44k views

What's the difference between <TargetFramework> and <RuntimeFrameworkVersion>?

I have the following code in a csproj file: <TargetFramework>netcoreapp1.0</TargetFramework> In the NuGet package manager, it says that I have Microsoft.NETCore.App version 1.0.5 Now let'...
8protons's user avatar
  • 3,811
46 votes
1 answer
34k views

.Net Framework and .Net Core in same solution

I have an application targeting .NET Framework, and now I need to develop a library in .NET Core. I plan to put both projects in the same solution and add the .NET Core library as a reference in the ....
vKint's user avatar
  • 461
44 votes
1 answer
16k views

Setting custom <OutputPath> in .NET Core (stop adding framework target)? [duplicate]

In traditional .NET applications, it was possible to set a custom <OutputPath> of an assembly in the .csproj file (or via the project properties dialog). A path of e.g. bin\$(Configuration)\$(...
maelgrove's user avatar
  • 959
44 votes
20 answers
28k views

Resource file "**/*.resx" cannot be found. (MSB3552) on VS for Mac

We can't build solution on vs for Mac version but the same solution can build on vs for windows (vs 2017) and it's worked. How to fix on this problem ? and can support on both (vs on windows & vs ...
Uthen's user avatar
  • 697
43 votes
4 answers
14k views

How to disable Browser Link in ASP.NET Core (.NET 6, VS 2022)

I have disabled Browser Link inside Visual Studio 2022, and I have also disabled all the Hot Reload functionality. Even the Browser Link Dashboard indicates it should be disabled: I also do not use ...
Tom Pažourek's user avatar
41 votes
3 answers
46k views

Change NuGet package folders used by Visual Studio

There is no more packages solution folder in any csproj or project.json-based .NET Core project. NuGet CLI gets the list of used cache folders: nuget locals all -list Response: http-cache: C:\...
Ilya Chumakov's user avatar
41 votes
6 answers
42k views

Running dotnet command line within Visual Studio

The majority of .NET core tutorials online seem to use Visual Studio code, rather than Visual Studio (Full fat? Is there a proper term for the full version? I use Professional but there is also ...
AndyNZ's user avatar
  • 2,223
40 votes
5 answers
26k views

Including referenced project DLLs in nuget package [.Net Core RC3 *.csproj file]

I have a solution with two projects in it. First project is called Library1, which references project two called Referencelibrary. I am trying to embed the DLLs for ReferenceLibrary inside Library1's ...
Zorthgo's user avatar
  • 2,927
40 votes
1 answer
11k views

What is the new GlobalSection in a VS2017 15.3 solution file?

After upgrading to Visual Studio 2017 15.3.1 and ASP.NET Core 2.0, my solution file now has this at the end: GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {...a GUID...} ...
grokky's user avatar
  • 8,805
39 votes
4 answers
37k views

How to force Visual Studio to re-create the SSL certificate for a .NET Core Web Application running Kestrel?

When a web project is created, Visual Studio automatically generates a SSL certificate and prompts you to install it. Everything works fine. That certificate has now expired and I cannot figure out ...
automaton's user avatar
  • 2,490
38 votes
8 answers
49k views

Should I install Visual Studio 2017 beside Visual Studio 2015 or should I first uninstall Visual Studio 2015 and then install Visual Studio 2017?

I am currently using Visual Studio 2015 for programming ASP.NET Core applications. I have the following questions regarding installing Visual Studio 2017: What is considered to be best practice and/...
jump4791's user avatar
  • 1,233
35 votes
9 answers
46k views

VS 2017 15.3 Yellow Triangles on References

This morning I upgraded to VS 2017 15.3 and now am getting yellow triangles for most of my references. The project runs fine (build is good in CLI and VS and restore has been run multiple times) that ...
dodegaard's user avatar
  • 1,087
33 votes
9 answers
37k views

C# Predefined type 'System.Object' is not defined or imported

In .NET core project, I changed the all projects name than after reloading all project that time many errors were showing approx 3225. And mainly all errors are related to system namespace like ...
Akash Limbani's user avatar
32 votes
2 answers
23k views

How do I actually create a .NET Core project in Visual Studio?

Maybe this is super obvious and I just can't find it but how can I create a .NET Core project in Visual Studio (2015 or, preferably, 2013)? I just want to run a console application on a Linux machine. ...
Brandon's user avatar
  • 4,521
30 votes
1 answer
17k views

Where is Create Unit Test in VS 2017?

I understand that this question has been asked before on SO and it appears that this feature was removed from VS at some point. But I am looking at a Microsoft tutorial right now and that says there ...
lfk's user avatar
  • 2,513
30 votes
5 answers
6k views

Visual Studio update 3 installer is trying to install update 2 instead

.NET Core 1.0.0 was released yesterday and it needs VS update 3 to be installed. So I downloaded the installer from here and tried installing but this weird issue is happening: It's as if the ...
mrahhal's user avatar
  • 3,372
29 votes
1 answer
3k views

How can I get Visual Studio to use Embedded Source code whilst debugging?

I have embedded the C# source code into a portable PDB file using the <EmbedAllSources> element in the csproj file, and I have embedded the pdb into the assembly using the <DebugType>...
Daniel James Bryars's user avatar
28 votes
2 answers
16k views

Building a .NET Core app via command line, so that it works on a machine without .NET Core installed

My end goal is to create a cross-platform (non-web) console application, so I'm exploring .NET Core right now. In my previous .NET projects, I did all the development inside Visual Studio, but I also ...
Christian Specht's user avatar
28 votes
3 answers
38k views

Migrate .NET Framework 4.8 to .NET 5

Recently Microsoft has release .NET 5. If we want to upgrade .NET Framework 4.8 to .net 5 then how can we accomplish this task. Please Note : I had already upgrade Visual Studio 18.2 with all latest ...
Dave Kapildev's user avatar
27 votes
1 answer
22k views

Include Nuget dependencies in my build output?

I am building a modular .NET core application that can load extensions at runtime using MEF. I have 2 projects, one is a library that I want to be able to load at runtime, then I have my main ...
ldam's user avatar
  • 4,544
27 votes
2 answers
17k views

Visual Studio 2017 only has offline Nuget Packages for .NET Core 2.x. How to get online packages?

I want to get NuGet Packages from Nuget online, but Visual Studio is only giving me 'Microsoft Visual Studio Offline Packages' as an option. I have tried adding another package source using the ...
JsAndDotNet's user avatar
  • 16.6k
26 votes
1 answer
27k views

How to change .NET Framework to .NET Standard/Core in Visual Studio?

I have a solution in C# in Visual Studios. It was first created in .NET Framework. I want to convert the project to .NET Standard/Core. If I go into project --> properties I see the attached screen,...
ENV's user avatar
  • 1,058
24 votes
9 answers
59k views

The reference assemblies for framework .NETCore, Version=v5.0 were not found

I have a UWP project that was created using Visual Studio 2017. It builds fine on this machine (machine 1). However, when I copy the project over to a machine (machine 2) where I only have the Visual ...
Ash's user avatar
  • 2,189
24 votes
10 answers
109k views

HTTP Error 500: localhost is currently unable to handle this request

I'm running into an HTPP Error 500 and I'm not sure why. When I start my service, I pop open a Chrome browser and navigate to http://localhost:5000, and the error pops up. The Chrome Developer Tools ...
Roka545's user avatar
  • 3,474
24 votes
2 answers
10k views

Hide files in .csproj without excluding them from build

Is it possible to hide files/folders in .net core csproj without excluding them from build? I have a folder containing generated files which I would rather see they are not visible inside Solution ...
redman's user avatar
  • 2,145
24 votes
6 answers
9k views

Does .Net Core support User Secrets per environment?

Let's say I have connection string for Development environment specified in appsettings.Development.json and connection string for the Staging environment specified in appsettings.Staging.json All I ...
Joe Schmoe's user avatar
  • 1,666
24 votes
1 answer
16k views

Opening Visual Studio 2017 projects in Visual Studio 2015

I've moved on to Visual Studio 2017 RC, but we still have people working on Visual Studio 2015. Currently when I create a project on 2017, it won't work on 2015. When the project is opened on VS2015 I ...
Zorthgo's user avatar
  • 2,927
24 votes
4 answers
39k views

How to properly stop running dotnet core web application?

In Visual Studio 2017 and 2019 on Windows, I run dotnet watch run in the Package Manager Console. It launched kestrel for a dotnet core app, automatically disabled text edit in the console, and ...
Roman Svitukha's user avatar
23 votes
3 answers
26k views

Visual Studio indentation set to two spaces instead of four space tab

I have just opened an old project here at work. Someone appears to have changed the indentation. It's set to 2 spaces instead of four space tabbing. What I have tried: I tried doing a Ctrl + KD ...
Linda Lawton - DaImTo's user avatar
23 votes
3 answers
10k views

Calculate Code Metrics for .NET Core Projects?

I am playing arround with ASP.NET Core and .NET Core projects. For classic C# projects Visual Studio 2015 has got the feature to calculate code metrics. For .NET Core the support is missing in the ...
Ralf Bönning's user avatar
22 votes
2 answers
91k views

Form view designer is not working in Visual Studio 2019 with C# .NET Core 3.1 [duplicate]

When I am opening a Visual Studio project with VB.NET then the Form view designer is automatically opened, but when I open a new project with C# .NET Core 3.1 with Windows Forms then it is showing ...
SRSENT's user avatar
  • 239
22 votes
2 answers
9k views

Missing visual studio 2019 blazor webassembly app template

I updated my vs 2019 16.3.10 to 16.4 and .net core 3.0 to .net core 3.1 but the blazor web assembly application template is missing.
Omid Ataei's user avatar
22 votes
4 answers
40k views

Use Visual Studio 2017 with .Net Core SDK 2.0

Can i open a core 2.0 project in Visual Studio 2017? I've installed the latest dotnet-core (2.0.0-preview2-005840) and created a core 2.0 console-app. mkdir dn2cli cd dn2cli dotnet new console ...
juwens's user avatar
  • 3,868
21 votes
6 answers
25k views

.NET Core 2.0 missing from my Visual Studio

So I've installed the official .NET Core 2.0 SDK and when I'm in Visual Studio i get heaps of errors and the target framework is not listed :( It's like .NET Core 2.0 isn't installed. and here's ...
Pure.Krome's user avatar
  • 85.7k
21 votes
2 answers
43k views

Unable to find package . No packages exist with this id in source. .NET core

I am trying to use a project as nuget package in other solution. The project i want to use has 2 references to other projects in the solution he is at. I am creating the .nupkg file using the cli ...
ATT's user avatar
  • 981

1
2 3 4 5
25