question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CRUD dotnet commands for MSBuild properties

See original GitHub issue

Would be nice if dotnet had commands to add/read/change/remove properties in an MSBuild file.

Example: dotnet prop set VersionSuffix beta Would update project to include, or would alter its value if it already exists

<PropertyGroup>
   <VersionSuffix>beta</VersionSuffix>
</PropertyGroup>

Example 2: Reading properties values.

$ dotnet prop get OutputType
Exe

Scenarios:

  • Tools like dotnet-user-secrets may want to read or manipulate a property in the csproj. Example feature on this tool: https://github.com/aspnet/DotNetTools/issues/166
  • Good for automation scripts such as auto-updating versions. Ex: dotnet prop set VersionPrefix 2.0.0
  • Support reading multiple properties at once. This would simplify MSBuild interaction for CLI tools such as ‘dotnet-ef’ that need multiple properties from a project.

cc @blackdwarf

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
natemcmastercommented, Mar 8, 2017

Could we start with “get” and do “set” later?

Almost all CLI tools need to read properties like OutputPath, AssemblyName, TargetFramework, etc. (dotnet-watch, dotnet-ef, dotnet-xunit to name a few)

Only a few of them need to edit a csproj. And there are simple solutions for this. For example, a CLI tool might simply print a message that says “Please add <xml here> to your csproj”.

0reactions
WeihanLicommented, Mar 1, 2021

Any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet build command - .NET CLI
The dotnet build command builds the project and its dependencies into a set of binaries. The binaries include the project's code in Intermediate ......
Read more >
NET + MSBuild - C# Project File (.csproj) in a Nutshell
A .NET project file specifies the components in the project and how it is built using MSBuild XML code made up of four...
Read more >
dotnet msbuild command - .NET CLI
The dotnet msbuild command allows access to a fully functional MSBuild. The command has the exact same capabilities as the existing MSBuild ......
Read more >
NET 7.0 + Dapper + MS SQL Server - CRUD API Tutorial in ...
In this tutorial we'll show how to build a .NET 7.0 (ASP.NET Core) API with Dapper and MS SQL Server that supports CRUD...
Read more >
MSBuild reference for .NET SDK projects
Reference for the MSBuild properties and items that are understood by the .NET SDK.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found