A file with the 'csproj' file extension is a Visual Studio .NET C# Project file.
Questions tagged [csproj]
1301 questions
27
votes
3 answers
How can I use BeforeBuild and AfterBuild targets with Visual Studio 2017?
After upgrading to a csproj to use Visual Studio 2017 and Microsoft.NET.Sdk, my "BeforeBuild" and "AfterBuild" targets are no longer running. My file looks like this:
…

natemcmaster
- 25,673
- 6
- 78
- 100
26
votes
3 answers
Reusable PropertyGroup elements in a csproj file
I have a series of properties I need to set in ~15 projects. Is there a way to put these properties in a single file and have all the project files reference the one file using some sort of import directive rather than duplicating the properties in…

Daniel Schaffer
- 56,753
- 31
- 116
- 165
26
votes
6 answers
Compiling a .vbproj or .csproj project file without Visual Studio
Is there a way to compile a .vbproj or .csproj project file directly, just like Visual Studio does?
When you compile in Visual Studio, the "output" window shows the actual call to the compiler, which normally looks like:
vbc.exe [bunch of options]…

Daniel Magliola
- 30,898
- 61
- 164
- 243
25
votes
2 answers
How to convert a non-core csproj to VS2017 format
I have two projects in VS2015
One .NET Core (project.json, xproj)
One regular .NET csproj
When I open project 1 with VS2017, it nicely migrates to the new csproj format.
Project 2 works in VS2017, but I like to convert/migrate/update this…

Julian
- 33,915
- 22
- 119
- 174
25
votes
2 answers
Do I need AssemblyInfo while working with .NET Core?
Previously, AssemblyInfo.cs file was autocreated by Visual Studio to contain assembly-wide attributes, like AssemblyVersion, AssemblyName and so on.
In .NET Core and ASP.NET Core, project.json is responsible for holding most of that information.
So…

brutallord
- 861
- 2
- 11
- 16
25
votes
3 answers
MsBuild copy file after build
I want to copy an xml file from the main directory to bin\Debug after building the project, but my solution doesn't work. I edited .csproj file and added:

KlimczakM
- 12,576
- 11
- 64
- 83
24
votes
5 answers
MSBuild project file: Copy item to specific location in output directory
In the process of cleaning up the folder/file structure on a project I inherited, I'm running into a problem with organizing the required external libraries. I want to keep them in their own .\dll\ folder, but they're not being copied to the build…

chezy525
- 4,025
- 6
- 28
- 41
24
votes
2 answers
New .csproj format - How to specify entire directory as "linked file" to a subdirectory?
With the new .csproj format (as well as the old), it is possible to add files as linked outside of the project folder:
It is also possible to use a glob pattern to…

NightOwl888
- 55,572
- 24
- 139
- 212
24
votes
1 answer
Build errors when multi-targeting in csproj file
I'm trying to build a class library that multi-targets both .NET 4.5.1 and .NET Standard 1.3. According to the documentation, I should be able to do this:
…

Nate Barbettini
- 51,256
- 26
- 134
- 147
23
votes
4 answers
Can I use both wildcard and Link element inside the Compile element?
In the .csrpoj file, If I have
Dir1\File1.cs
Then Visual Studio shows that file as a shortcut under Dir1 folder in the Solution Explorer.
If I have

Miserable Variable
- 28,432
- 15
- 72
- 133
23
votes
3 answers
How to use a custom attribute on an assembly in .NET Core 1.1
While I found this post regarding retrieving a custom attribute on an assembly, I am unsure on how to add a custom attribute to an assembly in .NET Core 1.1. In .NET Framework, I would have done something like:
[assembly:…

MVinca
- 291
- 2
- 4
- 11
23
votes
7 answers
How to copy files to output directory from a referenced NuGet package in .NET Core csproj?
I'm trying to use PhantomJS NuGet package in .NET core csproj application. But I think it is not possible using new PackageReference syntax for NuGet.
When I reference the PhantomJS package like this:

Ciantic
- 6,064
- 4
- 54
- 49
22
votes
2 answers
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 Explorer in Visual Studio.

redman
- 2,115
- 5
- 32
- 59
22
votes
2 answers
Why does Visual Studio prevent me from seeing the .csproj file, and is there a way to force it open?
When I sought the hardcoded origin of the port number my Web API uses, I found it in the project's *.csproj file. Yet when I 2-click it from the Find Results window in Visual Studio, it won't open and I'm rather brusquely informed, "The document…

B. Clay Shannon-B. Crow Raven
- 8,547
- 144
- 472
- 862
21
votes
1 answer
How do I include DLLs in my .csproj file?
Well, the thing is that I don't have Visual Studio installed and I don't want to install it, so, I made a batch file that compiles my .csproj file and all of my source files too.
The problem is that I don't know how to include .dll files. Here is…

Marcus S
- 435
- 4
- 11
- 15