All Questions
457
questions
0
votes
0
answers
42
views
Build csproj on Visual Studio without building references
Lets say you have a solution with projects A and B. A needs to B be build at least once so in order to be built with MSBuild i need it to be some kind of reference to setup the order of build.
But ...
1
vote
1
answer
45
views
MSBuild conditions: detect whether project file is built as project reference or standalone executable
I'm dealing with the NETSDK1152: Found multiple publish output files with the same relative path error while building a rather complex project. My project A depends on some classes in project B, both ...
1
vote
1
answer
44
views
How to change targetframework based on Visual Studio version
I would like to support from .NET Standard 2.0 to .NET 8.0 every target in a projects. Currently
<TargetFrameworks>$(ExtraTargetFrameworks)netstandard2.0</TargetFrameworks>
is used along ...
0
votes
1
answer
58
views
How to create a MSBuild target that runs when any file under 2 specific folders have changed
Context
I have two input folders - A and B.
I have an output folder - C.
There is a target that takes files from A and B and creates a set of files based on the inputs in directory C. There is no ...
0
votes
0
answers
23
views
VSCode 'csproj' actions only if the target is Windows
I am helping refactor some code so that it builds on both Windows and Linux.
All is well until an external, 3rd party, tool is needed.
Under windows this has been copied to the output folder via some ...
1
vote
1
answer
77
views
Variable in Directory.Build.Props not working for old-style csproj format
I tried using Directory.Build.props to setup some variables for use with our different project types.
<Project>
<PropertyGroup>
<!-- For SDK style c# projects -->
&...
0
votes
1
answer
88
views
Visual Studio 2022 - CSPROJ AssemblyAttribute Shows as Missing File
I'm trying to add a custom build time attribute to my assembly following the post here: https://blog.jermdavis.dev/posts/2023/build-metadata-dotnet
I've added the following class file for the ...
0
votes
0
answers
110
views
Microsoft.Build.Evaluation.Project (Version 17.9.5) causes Exception
In a tool written with C# (.NET6) I want to access the project file (csproj) of another project (also .NET6).
For this I have referenced the NuGet package Microsoft.Build (17.9.5)
In this library ...
1
vote
1
answer
85
views
MsBuild DefineConstants from .pubxml doesnt work correctly
I have ASP.NET Core + Blazor app (default template) with 2 projects.
When I create an IIS publish profile:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft....
0
votes
0
answers
43
views
MSBuild Plugin projects build and copying in csproj
I have an C# app app that is loading plugins, during development phase I want to have them copied to app output directory with their dependencies so I can debug easily. I have a task in the app csproj ...
0
votes
1
answer
52
views
Copy folder on publish ASP.NET Core
I need to copy the Views folder to the publish folder (on publish),
and I have this in my .csproj.
(Note: I don't need to change the views on runtime, different usage)
<Target Name="CopyViews&...
0
votes
0
answers
213
views
Multi-Targeting: Assets file 'project.assets.json' doesn't have a target for 'net6.0'
I am developing a library, which had been previously available under net6.0 and now i need to also provide it for net8.0.
When i switched
from <TargetFramework>net6.0</TargetFramework>
to &...
0
votes
0
answers
42
views
Git command formatting characters in msbuild are interpreted incorrectly [duplicate]
I wish to add a property with the date of the current Git commit to the assembly info.
From my .csproj:
<Exec Command="git -C "$(ProjectDir)." log -1 --pretty=format:%ad"...
1
vote
1
answer
52
views
Using variable in library dependency path in .NET
I'm developing a .NET 6 C# application, and I have some projects in the solution that depend on an external DLL library.
What I would like is being able to use a variable in the path to the library ...
0
votes
0
answers
38
views
Set webassembly WebRootFileProvider environment variable (in .csproj file) to ManifestEmbeddedFileProvider
I use this link: Can Razor Class Library pack static files (js, css etc) too? for my webassembly project that I want to also pack, to disable the default WebRootFileProvider and replace it with ...