Use properties in props/csproj files in C# code

六眼飞鱼酱① 提交于 2019-12-20 06:17:25

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41905149/use-properties-in-props-csproj-files-in-c-sharp-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!