Questions tagged [csproj]

A file with the 'csproj' file extension is a Visual Studio .NET C# Project file.

1301 questions
280
votes
16 answers

Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks"

I can't run my unit tests. I have the next error: Your project does not reference ".NETFramework,Version=v4.6.2" framework. Add a reference to ".NETFramework,Version=v4.6.2" in the "TargetFrameworks" property of your project file and then…
255
votes
14 answers

How to edit .csproj file

When I am compiling my .csproj file using .NET Framework 4.0 MSBUILD.EXE file, I am getting an error: "lable01" not found in the current context of "website01.csproj". Actually, I need to add every ASP.NET page with its code-behind file's reference.…
Karthik Malla
  • 5,570
  • 12
  • 46
  • 89
212
votes
3 answers

What is "Service Include" in a csproj file for?

In a C# solution, I added a existing project. After that, Visual Studio has added the following entry in other .csproj files: What's this for? Can I delete…
joe
  • 8,344
  • 9
  • 54
  • 80
199
votes
8 answers

In a .csproj file, what is for?

How is different from ?
Emmett
  • 14,035
  • 12
  • 56
  • 81
189
votes
6 answers

Designer Added then removed by Visual Studio on load/unload

Anyone see this before? I have a large Visual Studio project that keeps adding [Subtype]Designer[/Subtype] to my .vcproj then removing it on the next open and close of the project. There is only one class defined in StoredImageControl.cs. Anyone…
Jeff Lundstrom
  • 1,901
  • 2
  • 11
  • 5
169
votes
6 answers

How do I get .NET Core projects to copy NuGet references to the build output?

I'm trying to write a plugin system with .NET Core, and one of my requirements are to be able to distribute the plugin DLL along with its dependencies to the user for install. However, I can't figure out how to include my NuGet dependencies as a…
chyyran
  • 2,446
  • 2
  • 21
  • 35
119
votes
22 answers

Detected package downgrade warning (dotnet core, vs 2017)

I have just updated all my nuget packages for my solution (dotnet core 1.1 project). I am now getting the following warnings and I don't really know what they mean. Update: I am still getting warnings mentioned above. My web projects warn about…
Nik
  • 2,863
  • 6
  • 24
  • 29
111
votes
14 answers

Cannot find command 'dotnet ef'

I am using .NET Core 2.0 on Arch Linux / Visual Studio Code and am trying to get EF tools to work, but I keep getting the error: cannot find command dotnet ef I've just about looked everywhere and none of the suggestions worked. The result of…
Wasiim Ouro-sama
  • 1,485
  • 2
  • 12
  • 15
108
votes
1 answer

Relationship between the dotnet cli and the new vs2017 msbuild

With the move from project.json to the new csproj format introduced with VS2017, I'm struggling to understand the difference between the dotnet cli and the new msbuild and when to use one over the other. 1) To build a new csproj netstandard library…
kimsagro
  • 15,513
  • 17
  • 54
  • 69
106
votes
7 answers

Including content files in .csproj that are outside the project cone

I have a C# project say MyProject.csproj located at "C:\Projects\MyProject\". I also have files that I want copied into the output directory of this project. But, the files are at the location "C:\MyContentFiles\", i.e. they are NOT within the…
Poulo
  • 1,551
  • 3
  • 14
  • 22
104
votes
4 answers

How do you multi-target a .NET Core class library with csproj?

When .NET Core still used the project.json format, you could build a class library targeting multiple frameworks (e.g. net451, netcoreapp1.0). Now that the official project format is csproj using MSBuild, how do you specify multiple frameworks to…
Gigi
  • 28,163
  • 29
  • 106
  • 188
102
votes
9 answers

Is there a way to automatically include content files into asp.net project file?

I'm frequently adding a lot of content files (mostly images and js) to my ASP.NET project. I'm using VS publish system, and on publish, new files are not published until I include them in the project. I would like to auto include all files in…
Marko
  • 5,437
  • 4
  • 28
  • 47
94
votes
5 answers

Can files be nested in VS2017 Solution Explorer for .NET Core (non-ASP.NET Core) projects?

In "old school" MSBuild projects - as still used by Windows Forms in VS2017 for example - files could be "nested" via a DependentUpon item in the csproj file. I used this to group unit tests together in Noda Time, e.g.
Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
94
votes
3 answers

Visual Studio 2017 and the new .csproj InternalsVisibleTo

Where do I put InternalsVisibleTo from AssemblyInfo in the new Visual Studio 2017 .csproj project file?
Luka
  • 4,075
  • 3
  • 35
  • 61
87
votes
5 answers

What does the .csproj file do?

Usually a C# project has a .csproj file associated with it. What is that file for? What data does it contain?
Mircea
  • 3,369
  • 6
  • 27
  • 26
1
2 3
86 87