You are confusing assembly structure with folder layout in file system. This are entirely different things. Assembly (dll or exe) format is defined in CLI specification and has PE file format and is created during compilation of source code. Scripts which are in your project are stored in file system and unless they are marked for specific action in project i.e. resource they will remain were they are.
On the other hand if you mark them as a Embedded.Resource in Project Properties they will be stored in your project assembly as a managed resource which can be accessed during runtime. But it seems to be a weird method to having your scripts around while you are working with .NET.
May suggestion is to make static string or SqlCommand variables and assign to them your SQL queries. In this form they are not stored procedures.
The solution code based on managed resources is below. To get it working add to your project root file MySqlScripts.sql and mark it as Embedded.Resource. In this implementation default project root namespace was "SqlScriptAsAResource" and this is reflected in the name of embedded resources. Change file, namespace and embedded resource names accordingly.
using System;
using System.IO;
using System.Reflection;
namespace SqlScriptAsAResource
{
class Program
{
static void Main(string[] args)
{
Assembly myAssembly = Assembly.GetExecutingAssembly();
Stream resStream = myAssembly.GetManifestResourceStream("SqlScriptAsAResource.MySqlScripts.sql");
using(StreamReader reader = new StreamReader(resStream))
{
String sqlScript = reader.ReadToEnd();
// Use your SQL script
}
}
}
}
The solution based on static members is a this one:
using System;
using System.Data.SqlClient;
namespace SqlScriptAsAResource
{
internal static class SqlUtilities
{
public static readonly String SqlScriptValue = "SELECT * FROM Table1;";
public static readonly SqlCommand Commadn = new SqlCommand("SELECT * FROM Table1;");
}
}