Hi Friends,
I am getting following error while compiling code to assembly programatically.
I have a partial method declaration in the code.
error CS1519: Invalid token 'void' in class, struct, or interface member declaration}
Please check the code snippet.
The same code compiles successfully if it is added in .cs file and compiled using visual studio.
sw = new StringWriter( );
sw.Write( @"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
// Original file name:
// Generation date: 3/4/2009 3:57:16 PM
namespace EntityNamespaceModel
{
/// <summary>
/// There are no comments for EntityNamespaceModelEntities in the schema.
/// </summary>
public partial class EntityNamespaceModelEntities : global::System.Data.Objects.ObjectContext
{
partial void OnContextCreated();
/// <summary>
/// Initializes a new EntityNamespaceModelEntities object using the connection string found in the 'EntityNamespaceModelEntities' section of the application configuration file.
/// </summary>
public EntityNamespaceModelEntities() :
base(""name=EntityNamespaceModelEntities"", ""EntityNamespaceModelEntities"")
{
this.OnContextCreated();
}
/// <summary>
/// Initialize a new EntityNamespaceModelEntities object.
/// </summary>
public EntityNamespaceModelEntities(string connectionString) :
base(connectionString, ""EntityNamespaceModelEntities"")
{
this.OnContextCreated();
}
/// <summary>
/// Initialize a new EntityNamespaceModelEntities object.
/// </summary>
public EntityNamespaceModelEntities(global::System.Data.EntityClient.EntityConnection connection) :
base(connection, ""EntityNamespaceModelEntities"")
{
this.OnContextCreated();
}
}
}
" );
CompilerResults loCompiled = loCompiler.CompileAssemblyFromSource(loParameters, sw.ToString());
Thanks,
Sat..