Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Signing Assemblies with strong names

Signing Assemblies with strong names

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpannouncementdatabasecomtutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oceanexplorer
    wrote on last edited by
    #1

    I am currently following a book on how to sign assemblies with strong names in order to register a serviced component in the into the COM+ catalog and some errors are occuring. My AssemblyInfo.cs file currently looks like this: (of importance is the AssemblyKeyFile attriubte) using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.EnterpriseServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("StepByStep7_1")] [assembly: AssemblyDescription("Retrieve and update data from the Northwind database")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StepByStep7_1")] [assembly: AssemblyCopyright("Copyright © 2006")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ApplicationActivation(ActivationOption.Library)] [assembly: ApplicationName("NorthwindCS")] [assembly: AssemblyKeyFile(@"..\..\..\70320.snk")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2d37557e-b619-4092-80e4-4a30e2978021")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] When I build the application I get the following error: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile' Can anyone help explain why this error is coming up? The build itself actually does succeed, however it is giving me hassle when I come to register the serviced component in the COM+ catalog. I am presuming that it is because of the error in the build? I would be very grateful to anyone who can help in order that I may move on in the book as I have just got a second wind to return to my studies and want to make the most of it while it lasts!!! Thanks Pa

    S 1 Reply Last reply
    0
    • O oceanexplorer

      I am currently following a book on how to sign assemblies with strong names in order to register a serviced component in the into the COM+ catalog and some errors are occuring. My AssemblyInfo.cs file currently looks like this: (of importance is the AssemblyKeyFile attriubte) using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.EnterpriseServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("StepByStep7_1")] [assembly: AssemblyDescription("Retrieve and update data from the Northwind database")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("StepByStep7_1")] [assembly: AssemblyCopyright("Copyright © 2006")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ApplicationActivation(ActivationOption.Library)] [assembly: ApplicationName("NorthwindCS")] [assembly: AssemblyKeyFile(@"..\..\..\70320.snk")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2d37557e-b619-4092-80e4-4a30e2978021")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] When I build the application I get the following error: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFile' Can anyone help explain why this error is coming up? The build itself actually does succeed, however it is giving me hassle when I come to register the serviced component in the COM+ catalog. I am presuming that it is because of the error in the build? I would be very grateful to anyone who can help in order that I may move on in the book as I have just got a second wind to return to my studies and want to make the most of it while it lasts!!! Thanks Pa

      S Offline
      S Offline
      shaileshk
      wrote on last edited by
      #2

      Hi Paul, The way of signing the assembly with key file is changed. comment out the line "[assembly: AssemblyKeyFile(@"..\..\..\70320.snk")]" Right click the project and open the properties. Click on the Signing tab. Click the "Sign the assembly" - choose the key file over here and save the project Compile it. It should solve ur problem. With Regards, Shailesh kawade Knowledge Is Power.

      O 1 Reply Last reply
      0
      • S shaileshk

        Hi Paul, The way of signing the assembly with key file is changed. comment out the line "[assembly: AssemblyKeyFile(@"..\..\..\70320.snk")]" Right click the project and open the properties. Click on the Signing tab. Click the "Sign the assembly" - choose the key file over here and save the project Compile it. It should solve ur problem. With Regards, Shailesh kawade Knowledge Is Power.

        O Offline
        O Offline
        oceanexplorer
        wrote on last edited by
        #3

        Many thanks for your help, worked a treat! If I could ask one more favour, as I am struggling with this at the moment! I am now trying to register my DLL in the COM+ Catalog. To do this I am taking the manual approach and using the regsvcs.exe tool provided with the .net framwork. However when I regiser the dll it comes back that I have derived classes found in the assembly and won't register, saying that classes must be public, concrete and have a default constructor. Why is this happening? As far as I'm aware I haven't got any derived classes apart from the serviced component which is required. Below is my code for my class: using System; using System.Data; using System.Data.SqlClient; using System.EnterpriseServices; namespace StepByStep7_1 { public class NorthwindSC : ServicedComponent { private SqlConnection sqlcnn; private SqlDataAdapter sqlda; private DataSet ds; public NorthwindSC() { // Create a connection to the // Northwind SQL Server database sqlcnn = new SqlConnection("data source=(local);initial catalog=Northwind; User ID = SA;Password = *********"); } // This method executes a SELECT query and // returns the results in a DataSet object public DataSet ExecuteQuery(string strQuery) { // Create a SqlDataAdapter object to talk to the database sqlda = new SqlDataAdapter(strQuery, sqlcnn); // Create a DataSet object to hold the results ds = new DataSet(); // Fill the DataSet object sqlda.Fill(ds, "Results"); return ds; } // This method updates the database with the changes in a DataSet object public int UpdateData(DataSet ds) { // Update the database and return the result SqlCommandBuilder sqlcb = new SqlCommandBuilder(sqlda); return sqlda.Update(ds.Tables["Results"]); } } } Many thanks for your help Paul

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups