Dec 23, 2017 10:31 PM
(This post was last modified: Dec 24, 2017 12:23 AM by NovaHowl.)
Code
Public Function GenerateScript(code As String) As IScript
Using provider As New VBCodeProvider()
Dim parameters As New CompilerParameters()
parameters.GenerateInMemory = True
parameters.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location)
Dim interfaceNamespace As String = GetType(IScript).Namespace
Dim codeArray() As String = New String() {"Imports " & interfaceNamespace & Environment.NewLine & code}
Dim results As CompilerResults = provider.CompileAssemblyFromSource(parameters, codeArray)
Return CType(results.CompiledAssembly.CreateInstance("Script"), IScript)
End Using
End FunctionCode
System.IO.FileNotFoundException: 'Could not load file or assembly 'file:///C:\Users\nova\AppData\Local\Temp\ykujgxkp.dll' or one of its dependencies. The system cannot find the file specified.'Thanks!
Ok, I've realised now after some googling that the application is trying to access the system temp, not the local temp. I was wondering whether I could change it to use the local temp instead of the system one? And if so, how? Thanks!


