Questions tagged [csproj]
A file with the 'csproj' file extension is a Visual Studio .NET C# Project file.
1,305
questions
0
votes
0
answers
17
views
Asp.net core application is not published in docker
My Dockerfile:
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
WORKDIR /app
EXPOSE 5000
EXPOSE 5001
ENV ASPNETCORE_URLS=http://+:5000;http://+:5001
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS ...
0
votes
0
answers
23
views
Copy native NuGet-packaged DLL to build output
I have a .NET Standard 2.0 C# project Foo that produces a NuGet package with the following directory structure:
build/
x64/
FooNative.dll
lib/
netstandard2.0/
FooManaged.dll
...
0
votes
0
answers
38
views
What's a recommended way of building for many versions of a 3rd party library?
Our application depends on a 3rd party library with multiple versions (v1, v2, v3, etc). We would like to have a separate build for each of these versions.
One approach is to create a different build ...
0
votes
0
answers
68
views
.net Maui WhiteLabeling: How to have different Styles.xaml- and Colors.xaml-Files and use BuildConfiguration in .csproj to use the right one
I create a whitelabeling app in maui and need aplly different Ressources for different Customers befor the App compiles. For App-Icon, Fonts, Images it is not complicated. I created diffrent Build ...
0
votes
1
answer
25
views
Visual Studio $(Variable) for nuget root path?
I use a third-party nuget package that contains a content file that appears in my project which I'd like to copy to my output folder. Said and done.
Unfortunately what the project file then does is ...
0
votes
1
answer
64
views
Consume a nuget in legacy non-sdk project format with CLI
I need to consume a nuget (created with dotnet pack) in some old project created with legacy non-sdk project format.
So far I see few points:
I can't use dotnet add package .. with non-sdk projects ...
0
votes
0
answers
33
views
Unable to Copy the Media/Images from one project to the another on build in c# in VS 2022 in Wpf (using WindowsApp SDK)
I have these two csproj
One the main project
LIT
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</...
0
votes
0
answers
27
views
How can I detect if C# compiler (Roslyn) is running to get IDE diagnostics on VSCode instead of explicit dotnet building?
Is there a csproj target or property that I can use to differentiate the automatic compilation that Roslyn LSP runs to give me diagnostics on VSCode from actual explicit build compilation?
I need to ...
0
votes
0
answers
14
views
.Net csproj files - what is the difference between "Reference Include" and "Reference Update"?
I've converted some old csproj files to Sdk Style using .Net upgrade assistant and now I see the following lines inside the upgraded csproj files:
<Reference Update="System.Core" />
&...
0
votes
1
answer
69
views
Exclude dependee ASP.NET Core web project assets from publish
I have three ASP.NET Core 7 projects:
Common: library project. Other projects depend upon it.
Web: razor pages project. Depends on Common.
Migrator: console project. Depends on Common, and Web (via ...
0
votes
1
answer
25
views
MSbuild up-to-date check for generated files does not work as needed
I have a c# project which includes several generated files (by T4) which are later included in compilation. The generation of code files itself works fine, but unfortunately incremental build sees ...
0
votes
0
answers
27
views
C#, Protobuf file, NuGet-package
I have a nuget package that has 'proto' files in the "lib/protos" path.
How can I specify the path to these files in a project that uses the NuGet package?
I don't know what to add to csproj....
0
votes
0
answers
13
views
RuntimeIdentifier: win-x64 vs win7-x64 [duplicate]
Which one is the more generic or appropriate one for Windows 10 / 11?
I know the official chart from here but I don't know how to read it.
Does win-x64 include old stuff like XP and Vista and win7-x64 ...
0
votes
1
answer
20
views
The command "call $(ProjectDir)some_console_application.exe" exited with code 1
I get this error when trying to publish my website
The command call c:\..\..\some_console_application.exe exited with code 1
When i use this command call c:\..\..\some_console_application.exe from the ...
0
votes
0
answers
24
views
How can I enable IntelliSense for external C# code in VS Code without creating a new project or moving files?
I have a main Assembly-CSharp.csproj and associated files that provide functions, definitions and documentation for them (and thus hints/tooltips/auto-completion/etc.). And I have another folder ...
0
votes
0
answers
34
views
How to run unit tests using UITestMethodAttribute with WindowsAppSDK?
I'm trying to create unit tests for views in my WindowsAppSDK application. I want to be able to run tests with the UITestMethodAttribute.
I'm running into build errors and the test host process ...
1
vote
1
answer
25
views
Hide embedded nuget files from VS solution explorer
I create my first Nuget Package of my incremental source generator.
All was OK, targeting it as an analyzer in .csproj, embedded under analyzer/cs Nuget subfolders.
But now I want to improve my ...
0
votes
0
answers
21
views
Creating an x86/x64 nuget package without nusepc in new csproj format
One of the drawbacks of the nuspec file is that you need to list you nuget dependencies all over again and don't you dare forget it when updating one of your dependencies. For example here.
As a test ...
0
votes
0
answers
46
views
C# Passing a property from one csproj to another
So I have some files I'd like to exclude from the compile when running tests, but they're needed at other times.
So I was hoping I could set a property in the test csproj and pass it into the main ...
0
votes
0
answers
11
views
Is it possible to have Visual Studio display a different Solution Explorer name than the csproj file name?
I have a solution with a few projects in them, and each of the projects use a fully qualified name, such as ABC.Appname.Api and ABC.Appname.Web. With a long app name, this can make the names of the ...
1
vote
1
answer
54
views
(Visual Studio/C#) Add file to Intellisense, but don't compile
I'm writing a C# library at work for internal use. The use cases are pretty specific, so I want people who use it to have a couple samples Program.cs to get them started.
The problem I have is that if ...
0
votes
0
answers
10
views
File csproj : how to create a nuget package with msbuild and with package dependencies?
Hello,
in a .csproj file, I create a nuget package with msbuild.
All works, except that I want this package is dependent of another nuget packages.
These packages are NOT referenced in the project. ...
0
votes
1
answer
24
views
How to find output directory in a CSPROJ file?
Currently I have a csproj file that gets built on an external machine.
I have multiple of the following tags in it:
<ItemGroup>
<None Include="$(some_file)">
<...
0
votes
0
answers
48
views
Not able to access Project to Project Reference in c# (path issue of dll)
I have Project M (Main Project), S(shared project), and two class Libraries A and B. All projects have a new Build Configuration Test. S has project references of class libraries A and B. In S project ...
0
votes
1
answer
41
views
Cluttering lic files after migrating csproj files to sdk style
I am migrating some csproj files from the old style to the new SDK style for an old solution.After migrating, I found some lic files appearing within the projects, which were not seen in the solution ...
0
votes
0
answers
19
views
.NET multi target Nuget
I am building a Nuget targeting .NET 4.5.2 and 4.7.2 Hence I have used Multi Target in the csproj file(uses Microsoft.NET.Sdk for project template), and I have used GeneratePackageOnBuild to generate ...
0
votes
0
answers
38
views
CS2002 warning output when using EmbeddedResource
What I have tried
The following settings in csproj are used to create resource files from plain text and generate strongly typed files.
<ItemGroup>
<EmbeddedResource Include="Resources\...
0
votes
1
answer
56
views
Downgrade .NET 6 API to .NET Core 3
I cannot create a .NET Core 3 application using Visual Studio 2022. It is only showing .NET 6 and 7.
I want to publish this API on IIS server, which does not support .NET 6.
I tried to change the ...
0
votes
0
answers
26
views
Provide package id for project reference
I have two projects in a solution, ProjectA and ProjectB. ProjectA has a ProjectReference to ProjectB.
Both projects are built as nuget packages. The PackageId for ProjectB is lets say PackageB.
The ...
0
votes
0
answers
122
views
Error: The reference assemblies for ".NETFramework,Version=v6.0" were not found
I need help, because I can't solve this problem alone. I rebuild a C# project in VS 2019.
In first, I didn't have dotnet folder, so I downloaded it from here:
Download .NET Core 2.1
Download .NET Core ...
0
votes
1
answer
86
views
NuGet does not resolve transitive dependencies
I am trying to build a NuGet package from a project (Sub.nupkg). This works quite well.
The problems start as soon as this project itself uses a NuGet (Base.nupkg) which contains contentFiles. These ...
0
votes
0
answers
40
views
How to generate .d.ts and .Designer.cs files from .resx file
I am working with a slightly older Typescript project which is large enough that it takes a while to build everything. But sometimes when I'm adding a bunch of strings to the resx file, I just want to ...
0
votes
0
answers
10
views
Publish CSPROJ without PackageReference dependencies
If you publish a CSPROJ that has a PackageReference to i.e. the Microsoft.Extensions.DependencyInjection NuGet package, then you will also get the DLLs for Microsoft.Extensions.DependencyInjection....
2
votes
0
answers
57
views
Question about .NET dependency resolution of System dependencies
I need help understanding how the dotnet SDK resolves dependencies, as there is something missing in my understanding that confuses me.
My question in a nutshell: When given a target framework of net7....
0
votes
1
answer
11
views
Set PropertyGroup property to Exec output
I would like my SDK-style project's assembly to automatically include the Git revision number in the <VersionSuffix>.
I feel like I'm close:
<Project>
<Import Project="Sdk....
0
votes
1
answer
30
views
reference property of one project file in another project file
I have one project file, "LibraryProject.csproj":
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<...
0
votes
1
answer
53
views
Visual Studio: Prevent CodeAnalysis from running on cs files included via nuget
I'm referencing the BlingFireNuget package in my csproj. It adds a bunch of files to my project, including a couple cs files, like BlingFireUtils.cs. These are adding hundreds of code analysis ...
0
votes
0
answers
23
views
Why would all my project files be hidden in VS2023 on Windows
I have a demo project I am working on, and none of the project files show up in my project, and none of the projects will build.
I am on a Windows 11 machine running the latest VS2023.
Others on my ...
0
votes
0
answers
44
views
dotnet7 *.csproj not created in publish folder after command "dotnet publish"
i try to run command dotnet run --launch-profile myProfile on ubuntu server, and i get this error:
Couldn't find a project to run. Ensure a project exists in /home/ubuntu/dotnet7proj/publish, or pass ...
0
votes
0
answers
51
views
In the C# project .csproj file, how to dynamically obtain the referenced package name and version?
example
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DefineConstants>$(DefineConstants);USE_MYSQL_CONNECTOR;</DefineConstants>
</PropertyGroup>
...
0
votes
0
answers
35
views
How to compare version of a specific NuGet package inside .csprog file
I am using conditional compilation and in the condition I need to compare the installed version of a specific Nuget package with the given version. Can this be done inside .csprog file?
<ItemGroup&...
1
vote
0
answers
11
views
Csproj: Inherit Nugets from somwhere?
I have a solution with many projects and test projects. While the References for the real projects vary wildly, the test project have mostly the same, maybe sometimes extra dependencies but nevers ...
1
vote
1
answer
30
views
What a vertical bar means in a PropertyGroup .csproj file
I have a PropertyGroup like this:
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>$(DefineConstants)TRACE;X86</DefineConstants>
&...
1
vote
0
answers
235
views
.NET6 Executable name defaulting to apphost.exe
We have a .NET6 project console application (in Visual Studio 2022), that has been migrated from .NET Framework 4.7.1. The project builds without issue, and produces an executable in the intermediate ...
0
votes
0
answers
162
views
Unexpected runtime ID error when trying to use the Run and Debug feature in Visual Studio on Windows 10 x86 with c# csproj
enter image description here
What is the solution for unexpected runtimeid win10 x86
The image has been attached above
Using running and debugging results unexpected runtimeid win10 x86 and which is ...
0
votes
1
answer
106
views
C# projects importing a props file ignores output type
I have a solution with multiple projects. Most are libraries except for two that are EXE projects.
I wanted to share assembly information in a file.
<Project Sdk="Microsoft.NET.Sdk">
...
0
votes
1
answer
22
views
Prevent url decoding of values in csproj files
I have the following scenario. I call a tool to generate code from data obtained via a rest service, like so:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<...
0
votes
0
answers
33
views
.NET: Managing Runtime Dependencies in Dependent Projects
I have two projects, Project A and Project B, where Project B depends on Project A. Project A has a runtime dependency called EntityFramework.SqlServer.dll, which is not required during compile time ...
0
votes
1
answer
36
views
Call script only once before all builds in a multi-targeting project
I'm having a multiple targeting project using a script that generates classes out of a XSD. That should only be done once - for all build targets.
I found that SO-question but this solution does not ...
0
votes
1
answer
228
views
Visual Studio Installer not copying all files from publish directory
I have an issue with the Visual Studio installer extension.
I need to copy files from a subfolder to the output root folder when creating an installer package.
Since the installer project uses the &...