Loading...
 
Multi-Language Add-In for Visual Studio

Multi-Language Add-In for Visual Studio


Warning on compilations

Hello Phil,

Since last versions, I'm getting this warning when compiling:

Warning 24 The field 'MultiLang.ml.RootNamespace' is assigned but its value is never used \MlString.cs

I assume you use the RootNamespace field somewhere on the design time? We have a policy of "no warnings" allowed, and it'd be nice to not have this one coming up for every project on the solution.

Can I comment out those lines without causing any trouble to the design time component? A parameter to not create those? Fixes would be mostly appreciated!

Thanks in advance,
caco

> Hello Phil,
>
> Since last versions, I'm getting this warning when compiling:
>
> Warning 24 The field 'MultiLang.ml.RootNamespace' is assigned but its value is never used \MlString.cs
>
> I assume you use the RootNamespace field somewhere on the design time? We have a policy of "no warnings" allowed, and it'd be nice to not have this one coming up for every project on the solution.
>
> Can I comment out those lines without causing any trouble to the design time component? A parameter to not create those? Fixes would be mostly appreciated!
>
> Thanks in advance,
> caco


Germany

I made a change to the template file for MlString.cs quite a long time ago.

To open the resource file, it needs to know the RootNamespace of the project. Originally, it simply fetched the name of the assembly with

Old method
static ml()
{
  string RootNamespace = Assembly.GetExecutingAssembly().GetName().Name ;
  ResMgr = new ResourceManager ( RootNamespace + ".MultiLang", Assembly.GetExecutingAssembly() ) ; //MLHIDE
}

This is usually correct, but not always. I never found a reliable way to programatically determine the RootNamespace of the running project, but I did find an easy way to determine if from within the Add-In.

Therefore I added code to the Add-In to insert a constant string with the RootNamespace into this module, and changed the code in the template file to use this constant.

New method
// Inserted by the Add-In
private static string RootNamespace = "SimpleEditor" ; //MLHIDE

static ml()
{
  ResMgr = new ResourceManager ( RootNamespace + ".MultiLang", Assembly.GetExecutingAssembly ( ) ) ; //MLHIDE
}

I guess that you have an old version of MlString.cs. The Add-In has inserted the definition of RootNamespace, but the old version noes not use it.

I suggest that you change the code in the static constructor. You can copy it from here, or from the template file
<program files>\MultiLang2005\Templates\MlString.cs

Phil


Thanks again Phil!!

Regards,
caco