Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / May 2004

Tip: Looking for answers? Try searching our database.

VS.NET 2003 doesn't honor the version of assemblies in .licx file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brock Reeve - 18 May 2004 19:51 GMT
VS.NET calls lc.exe at build time to extract the licenses from the types in
the .licx file, but it doesn't behave the same way as if you called lc.exe
from the command line stand alone. The two .licenses files generated are
different even though the .licx file is the same.

For example, suppose my .licx file had these contents:

NationalInstruments.Restricted.AnalysisLicenser,
NationalInstruments.Analysis.Enterprise, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

NationalInstruments.Net.DataSocket, NationalInstruments.Net,
Version=7.0.0.341, Culture=neutral, PublicKeyToken=4544464cdeaab541

NationalInstruments.Net.DataSocketServer, NationalInstruments.Net,
Version=7.0.0.341, Culture=neutral, PublicKeyToken=4544464cdeaab541

NationalInstruments.Net.DataSocketSource, NationalInstruments.Net,
Version=7.0.0.341, Culture=neutral, PublicKeyToken=4544464cdeaab541

NationalInstruments.UI.WindowsForms.Led,
NationalInstruments.UI.WindowsForms, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

NationalInstruments.UI.WindowsForms.Legend,
NationalInstruments.UI.WindowsForms, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

NationalInstruments.UI.WindowsForms.ScatterGraph,
NationalInstruments.UI.WindowsForms, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

NationalInstruments.UI.WindowsForms.Switch,
NationalInstruments.UI.WindowsForms, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

NationalInstruments.UI.WindowsForms.WaveformGraph,
NationalInstruments.UI.WindowsForms, Version=7.0.0.341, Culture=neutral,
PublicKeyToken=4544464cdeaab541

If I run "lc /target:test /complist:license.licx" the .licenses file
generated is correct.

If I edit the Version part of each type above in the .licx file to be
"BadVersion" and run "lc /target:test /complist:license.licx" I get an error
LC0003 error saying "licenses.licx(3) : error LC0003 : Unabled to resolve
type 'NationalInstruments.Restricted.AnalysisLicenser,
NationalInstruments.Analysis.Enterprise, Version=BadVersion,
Culture=neutral, PublicKeyToken=4544464cdeaab541' for every type in the
.licx file.  This makes sense. The version is bad.

What doesn't make sense is if I open the same .licx file in a VS project and
make the same change by changing the Version part to "BadVersion" and build,
VS is fine with it. The generated .licenses file in the obj\Debug\ folder
contains the 7.0.0.341 version. This seems weird. I would expect consistent
behavior.

This shows that VS is not reading the .licx file every time you
build/rebuild.  It must be caching the types in the .licx file at certain
times. This seems buggy and is causing troubles.  I want to be able to
change the versions in the .licx file and have VS honor it the next time a
build/rebuild occurs. For example, if I change the Version part of each type
to 7.1.0.213 in the .licx file I would expect the .licenses file to contain
7.1.0.213 version the next time a build/rebuild occurs in VS.  This does not
happen even though the 7.1.0.213 assemblies are in the GAC. However, running
lc.exe on 7.1.0.213 .licx file contains the 7.1.0.213 versions in the
generated .licenses file.

When is the .licx type caching done?  How can I force the contents of the
type cache that VS is holding to be refreshed so my version change in the
.licx file is honored? This seems like a bug.

Thanks,
Brock
"Ying-Shen Yu[MSFT]" - 19 May 2004 12:27 GMT
Hi Brock,

I did some test on my system according to your description, however the
result seems not same as yours, my test IDE is VS.NET 2003 with no patch.

If I replace the version part in licx file with string "badversion" ,
When build the project VS.NET IDE will report error " ....\licenses.licx
Could not transform licenses file 'licenses.licx' into a binary resource.  
Input string was not in a correct format."

If I replace the version part with some invalid version number, it will
compile through. However it is a designed behavior, when a type could not
be found using its full qualified type name, VS Designer will try to load
the type with partial type name,  in your case if you have the assembly
version 7.1.0.341 and specified the version part to 7.1.0.500 in licx file,
the version 7.1.0.341 will be loaded. the rest process is similiar as if
you specifiy version= 7.1.0.341 in licx file.

In your description about licensing the assembly in GAC, there should
I think there is no difference if the assembly is in GAC, the CLR loader
will load the correct version automatically, one thing you should remind is
the assembly is in GAC, the default GetLicence method in
LicFileLicenseProvider will try to load lic file from the same directory as
the component assembly.

If you still have questions on this issue, please feel free to reply this
thread.
Thanks!

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Brock Reeve - 25 May 2004 15:41 GMT
OK. I think we are mis-communicating.

If you replace the version of the .licx file with Version=badversion and
then open the project that doesn't have any references to the assemblies in
the .licx file or any licensed controls on the form you get the error.
However, if you have licensed controls on the form and you open the project
with the form opened and changed the .licx file to Version=badversion it
compiles fine. This leads me to believe that the designer is caching the
licensed types and the license providers.  So here are the steps:

1. Create a new project.
2. Drop a licensed component on the form.
3. Change the Version part to Version=BadVersion
4. Rebuild.
5. Notice the project built fine even though the version info is bad.

Brock

> Hi Brock,
>
[quoted text clipped - 32 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.
"Ying-Shen Yu[MSFT]" - 26 May 2004 07:35 GMT
Hi Brock,

Thanks for your reply,
My repro steps is smiliar to yours, I followed your steps and still got the
same error message, here is the detail steps:
1. Create a new project,(C# winform app)
2. Drop a Licensed Component on the Form.
3. save and close the Form Designer (to avoid the warning dialog).
4. open the licx file and change the version part to string "badversion".
5. save and close the licx file and rebuild

the build process failed due to
licenses.licx: Could not transform licenses file 'licenses.licx' into a
binary resource.  Input string was not in a correct format.

6. If I change the version part to a valid version format but match the
version of the licensed control (e.g. 5.0.0.0 for 1.0.0.1) the project
built fine, and works fine, I had explained the fall back mechanism in my
last reply. You may check the generated assembly using ILDASM and see the
resource in MANIFEST

The license control I use for test is the sample code in document
<Licensing Components and Controls>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconlicensingcomponent
scontrols.asp

I'd like you test it on your machine follow my test steps to see if it
works on your machine, so that we could find out the difference and have a
better understanding.

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
"Ying-Shen Yu[MSFT]" - 26 May 2004 07:52 GMT
Hi Brock,

Thanks for your reply!

My repro steps is very smiliar to yours, I followed your steps and still
got the
same error message, here is the detail steps:
1. Create a new project,(C# winform app)
2. Drop a Licensed Component on the Form.
3. save and close the Form Designer (to avoid the warning dialog).
4. open the licx file and change the version part to string "badversion".
5. save and close the licx file and rebuild

the build process failed due to
licenses.licx: Could not transform licenses file 'licenses.licx' into a
binary resource.  Input string was not in a correct format.

6. If I change the version part to a valid version format but match the
version of the licensed control (e.g. 5.0.0.0 for 1.0.0.1) the project
built fine, and works fine, I had explained the fall back mechanism in my
last reply.

The license control I use for test is the sample code in document
<Licensing Components and Controls>
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconlicensingcomponent
scontrols.asp

You may test it on your machine with my steps to see if it works on your
machine, so that we may find out the difference and have a better
understanding on this issue.

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.