1,397 questions
0
votes
1
answer
29
views
Building a C# project multiple times for every configuration
I have a C# project with few dependencies, and a list of build environment properties (dev, staging, prod). I am trying to build the project multiple times per env in a separate folder and with a ...
1
vote
0
answers
34
views
Run a Target in csproj with Microsoft.Net.Sdk after update from .NET 4.8 to .NET 8.0
I hope there is a simple answer to my question. I have updated a .NET 4.8 project to .NET 8.0. Now my project file is diffrent. That's clear. But how can I start my target now?
In .NET 4.8 I had one ...
4
votes
2
answers
101
views
Why does dotnet restore on a .sln ignore `DownloadContentFiles` tasks in .csproj projects?
I have an .sln referencing a single .csproj. Inside the .csproj I download static dependencies into ASP.NET's wwwroot:
<Target Name="DownloadContentFiles" BeforeTargets="Restore&...
0
votes
1
answer
66
views
csproj : Dependency selection based on target framework
My .NET project targets both .NET 6 and .NET 8, in my csproj file I have:
<PropertyGroup>
<TargetFrameworks>net8.0;net6.0</TargetFrameworks>
...
</PropertyGroup>
Then, ...
-1
votes
1
answer
43
views
Mysterious forced .csproj elements for Blazor components (App.razor)
Since I put my App.razor's @code into an App.razor.cs file, Visual Studio stuffed this crap into my .csproj file. Removing it gives these compile errors:
Here's the contents App.razor, just in case:
...
0
votes
1
answer
54
views
ClickOnce keeps including .so files despite being excluded in .csproj — how to permanently prevent this?
I'm publishing a .NET Framework 4.8 application using ClickOnce, and I have a persistent issue with LibGit2Sharp.NativeBinaries.
Every time I build and publish, files like libgit2-3f4182d.so.deploy ...
1
vote
1
answer
62
views
How to make UseWindowsForms conditional in csproj?
I have a C# library that I want to publish on Nuget. Currently it only builds if I target net8.0-windows because it has <UseWindowsForms>true</UseWindowsForms>.
However, it uses Windows ...
0
votes
0
answers
28
views
Add icon included in another nuget package to consuming project as PackageIcon
I have a nuget package where some targets and properties are defined. This package is used in many of my other projects. This package has an icon. It is generated from this nuspec:
<?xml version=&...
2
votes
1
answer
260
views
Using .Net 8 for iOS [NOT MAUI], add a LaunchScreen with logo image and background color
Goal:
Create a splash screen ("LaunchScreen") for a ".Net 8 for iOS" C# app (successor to "Xamarin Native / iOS").
The splash screen contains an image (a logo) scaled to ...
-1
votes
1
answer
112
views
.NET Core 8.0, .csproj : how do I execute a function that acts on one of ClickOnce's .deploy files?
I have a .NET Core 8.0 desktop app that I can publish either via folder or via ClickOnce.
For the folder solution I got something like:
<Target Name="ExecuteSomething" AfterTargets="...
0
votes
1
answer
92
views
csproj PostBuild command to execute a script in repository root directory
I have a monorepo with multiple solutions, we can see it simplified like this:
- monorepo
|- scripts
| |- script1.ps
|- src
|- projA
| |- projA.csproj
|- projB
...
0
votes
0
answers
37
views
How can you differentiate between project types in a Directory.Build.props?
I would like to set the $(OutDir) for certain projects in a Directory.Build.props. All projects have the common feature that they become executables (e.g. Microsoft.NET.Sdk.Worker, Microsoft.NET.Sdk....
0
votes
0
answers
71
views
How to have multiple PreBuild events in VS 2022 Microsoft.NET.Sdk.Web project
I have the situation where I have two different PreBuild events: One to be executed always, anotherone to be exectued only if configuration is 'Debug'.
In the csproj file I defined it as follow (look ...
0
votes
1
answer
56
views
Reuse the Directory.Build.props but add "-windows"
So for my C# projects I really enjoy using the Directory.Build.props e.g. for settings the dotnet version for the entire solution.
However, there is one hiccup for this.
When I set my version in the ...
0
votes
0
answers
95
views
.NET / C#: How to ignore GenerateDocumentationFile for source generated .g.cs files by packages
My .csproj file uses
<GenerateDocumentationFile>true</GenerateDocumentationFile>
to indicate that we will be auto-generating documentation.
A given package I use creates loads of code ...
1
vote
1
answer
49
views
Publish ASP.NET app without certain folders
I have a csproj with some folders with code from different clients.
When i publish my app i get something like this:
Client1Folder
Client2Folder
Client3Folder
Client3Folder2
SomeCommonFilesAndFolders
...
2
votes
1
answer
797
views
What is the difference between TargetFramework net8.0-windows and net8.0?
With .NET we can create projects(.csproj files) that can have TargetFrameWork as net8.0-windows and net8.0
net8.0-windows
<PropertyGroup>
<TargetFramework>net8.0-windows</...
0
votes
0
answers
54
views
When publishing a WinForm App (.NET Framework), is there a way to only publish a x86 folder with a .deploy file in it?
Currently I have a WinForm App (.NET Framework) that I am currently publishing to a local folder on my PC. It is creating an arm, arm64, musl-x64, x64, and an x86 folder. My target platform/CPU is set ...
1
vote
0
answers
38
views
Reducing duplicates in and size of dependency storage across multiple projects
I am currently working with a new program that has been developed to store all of its dependencies in a folder called 'Product'. I'm sort of new to .csproj files so I'm figuring this out as I go. I ...
2
votes
0
answers
159
views
Publish legacy symbol nuget packages
I have an empty legacy SDK C# class library project (with new Class1 class and single empty method inside him) and I want to publish it with symbols. I did this in the past for SDK project, but it ...
1
vote
1
answer
288
views
Is it possible to exclude a razor pages from a build in .NET Maui Blazor Hybrid App via the .csproj file?
Ok so I'm stuck trying to set configure a Maui Blazor Hybrid App, something I'm quite new to.
I have some views which need to be customized for some build configurations. I'm therefore looking to ...
2
votes
1
answer
183
views
how to Modify a CS file before Build target runs when Publishing
I have a number of applications that I build and deploy where I like to have versioning information available in the code. This versioning information consists of stuff like the GitHash and a Date of ...
1
vote
1
answer
109
views
MSBuild - csproj - Use combinations to exclude folder from build
In order to allow building our projects in Visual Studio and a Linux DevContainer side-by-side, I changed the build configuration of our project as follows:
Directory.Build.props
<Project>
<...
0
votes
0
answers
69
views
Rider .NET IIS 2024.2
I'm looking into running my project file locally in IIS, which years before I was running simply as is in Visual Studio. Now in Rider, not long ago they have introduced the feature to be able to run ...
0
votes
0
answers
28
views
csproj (msbuild) - Combine <Reference> and <PackageReference>, select one to use depending on bool property
I'm trying to define a new, custom element in Directory.Build.targets: <DynamicReference>. This definition should be a combination of <Reference> and <PackageReference>. The decision ...