As part of our development life cycle we have a number of process that we run against the C# source in our projects.
The processes are driven off a GUI that currently reads the *.csproj file to find the source files used within the project. This works fine.
We now have a new requirement to provide some validation processes that require a call out to a web-service. The web-service needs to be provided with some credentials that are project specific. Ideally we could enter and store these credentials within the *.csproj file but I don't see a means of extending it - is there?
We don't really want to introduce a new config. file just for these settings if we can help it. Is it possible to store information like this is the *.csproj file, if not is there any other place to put it.
thanks
You should be able to do this by right clicking the project in the Solution window and selecting Tools - Edit File. That will open the project file (. csproj) in the text editor.
What is a CSProj file? Files with CSPROJ extension represent a C# project file that contains the list of files included in a project along with the references to system assemblies.
CSPROJ files are are meant to be opened and edited in Microsoft Visual Studio (Windows, Mac) as part of Visual Studio projects. However, because CSPROJ files are XML files, you can open and edit them in any text or source code editor.
csproj Extension. This extension will helps you keep your csproj files in sync when using VS Code. This is useful if you work in a team that uses both VS Code and Visual Studio.
The .csproj
file is basically an MSBuild file, as such you can extend it with custom values. If you right-click on a project in Visual Studio and choose "Unload Project", the project will "grey out" and you can then right-click again and choose Edit [ProjectFileName].csproj
. You can then add something similar to the following:
<PropertyGroup Label="Custom">
<Badger>1</Badger>
</PropertyGroup>
This should be persisted when the project is modified (i.e. files added/removed) and you can retrieve the values from the file, using the method of your choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With