Use properties in props/csproj files in C# code

2020-05-05 18:06发布

Say I have a property SomeValue declared in my csproj file or in a props file.

Is there a way I can reference that property in my C# code?

标签: c# msbuild
1条回答
手持菜刀,她持情操
2楼-- · 2020-05-05 18:39

You could add a pre-build task to inject the value into your code but there is no way to reference a property because the project file is not part of the code - it's just a container for your code holding some properties that are used for templating your code files like for example the default namespace of your project that gets added to code files automatically.

查看更多
登录 后发表回答