3F / MvsSln

🧩 Customizable VisualStudio .sln parser with project support (.vcxproj, .csproj., …). Pluggable lightweight r/w handlers at runtime, and more …
MIT License
135 stars 27 forks source link

slnEnv Variable in README.MD #31

Closed astrohart closed 2 years ago

astrohart commented 3 years ago

See:

fig01

What's this variable? Where is it declared? Kindly please add the declaration of this variable to the example code, so that I might know why it's there/how to utilize this package.

Respectfully,

Brian H

3F commented 3 years ago

Hello Brian,

I am sorry for the unclear samples. I remind everyone that you can improve something via PR.

slnEnv variable in readme points to sln.Result.Env with its default implementation of the available environments. https://github.com/3F/MvsSln/blob/9ce5885282d65ee32bfc03808c83c1113c1928e3/MvsSln/Core/IEnvironment.cs#L32

To be clear, after #17 MvsSln 2.4+ may provide a several implementations such as basic IXProjectEnv environment and IEnvironment with IDisposable pattern.

The reason of IXProjectEnv was described in #17 and in short it delegates the releasing of resources at the user's choice. When, for example, you don't need to release it at all.

This concerns to programs like vsSolutionBuildEvent that works in various environments (VS EnvDTE, MSBuild, etc), this is it:

For the default* behavior MvsSln still works with IEnvironment which requires the use of disposing.

*The default behavior means our Sln wrapper with related flags, for example:

using(var sln = new Sln("...", SlnItems.Env | SlnItems.LoadMinimalDefaultData)
{
    //...
} // sln.Result.Env will be released as soon as GC will collect this outside this scope

Because some manual way is also provided like https://github.com/3F/DllExport/blob/master/Wizard/DxpIsolatedEnv.cs

In any case Sln class above is a simple wrapper https://github.com/3F/MvsSln/issues/10

Let me know if you still have the questions or problems.