예제 #1
0
        private Guid CompiledGuid(
            string source,
            string assemblyName,
            CSharpCompilationOptions options,
            EmitOptions emitOptions = null,
            Platform platform       = Platform.AnyCpu
            )
        {
            var compilation = CreateEmptyCompilation(
                source,
                assemblyName: assemblyName,
                references: new[] { MscorlibRef },
                options: options.WithDeterministic(true).WithPlatform(platform)
                );

            Guid result = default(Guid);

            base.CompileAndVerify(
                compilation,
                emitOptions: emitOptions,
                validator: a =>
            {
                var module = a.Modules[0];
                result     = module.GetModuleVersionIdOrThrow();
            }
                );

            return(result);
        }