Closed Temeez closed 8 years ago
This may have something to do with the TypeLite
package, since the file it's referencing (GnomeApp\app\models\models.ts
) is the TypeScript class definitions that are dynamically generated from the GnomeServer
project.
Does the GnomeServer
project build successfully?
Yes, GnomeServer
builds succesfully.
Well, that is indeed interesting. The instructions in the README
file were written for Version 0.0.1, but should be mostly identical for the latest commit on master
. Then again, I haven't verified this personally, so maybe I'm overlooking something.
The most prominent change since I uploaded Version 0.0.1 was upgrading TypeScript to 1.6. Do you have the TypeScript 1.6 update installed?
There have been other changes to the code since Version 0.0.1, which were also significant, but I'm doubtful that those changes could have introduced some weird issues.
Something else to check, but it should be set this way by default: I have had reports in the past that the project wouldn't compile unless the build configuration was set to Debug
/X86
. May be worth checking, at least.
Looks like I had the TypeScript 1.6 installed and the projects build with Debug x86.
I tried to start from the scratch and now things got a bit more interesting. Installation steps 1,2 and 3. After the NuGet installs things the solution builds and spits out 1 error and 1 warning.
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
1>------ Build started: Project: GnomeServer, Configuration: Debug x86 ------
1> GnomeServer -> C:\Users\Temeez\Desktop\GnomeServer-master\GnomeServer\bin\x86\Debug\GnomeServer.dll
2>------ Build started: Project: GnomoriaInjection, Configuration: Debug x86 ------
3>------ Build started: Project: GnomeApp, Configuration: Debug x86 ------
2> GnomoriaInjection -> C:\Users\Temeez\Desktop\GnomeServer-master\GnomoriaInjection\bin\x86\Debug\GnomoriaInjection.dll
3>VSTSC : error TS6053: Build: File 'C:/Users/Temeez/Desktop/GnomeServer-master/GnomeApp/app/models/Interfaces.d.ts' not found.
========== Build: 2 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Error Build: File 'C:/Users/Temeez/Desktop/GnomeServer-master/GnomeApp/app/models/Interfaces.d.ts' not found. GnomeApp C:\Users\Temeez\Desktop\GnomeServer-master\GnomeApp\VSTSC
Warning A custom tool 'TextTemplatingFileGenerator' is associated with file 'app\models\Interfaces.tt', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool. GnomeApp
If I do what the warning says, I get the following error:
Error Compiling transformation: Metadata file 'C:\Users\Temeez\Desktop\GnomeServer-master\GnomeApp\bin\GnomeApp.dll' could not be found GnomeApp C:\Users\Temeez\Desktop\GnomeServer-master\GnomeApp\app\models\Interfaces.tt 1
The .dll is indeed missing, since it couldn't build. If I now try to build the GnomeApp
project, I get the Cannot find namespace
error spam.
There is also a file Default.pubxml
in the Solution Explorer under the GnomeApp
project which doesn't seem to exist, but I guess that doesn't break things.
Oh, I guess I forgot a step. Getting the GnomeApp
project to work is something I haven't really touched on in the documentation, but probably should.
In the Solution Explorer, right click on the
GnomeApp\app\models\Interfaces.tt
file, and click Run Custom Tool
I might be able to work around that manual process by adding some type of pre-build action; this is just yet another area I haven't really spent enough time.
At any rate, the reason it can't find the namespace in the GnomeApp
project is entirely due to the missing file you've mentioned. As a general rule, I try to avoid the inclusion of generated files in my source-code repositories, and the file-in-question is generated from some class definitions in the GnomeServer
project. (The ones decorated with [TsClass]
, if you were curious).
To save you some trouble, here's my copy of the generated file. It should be the most recent version, so hopefully there won't be any issues. Just place it in the same directory as the .tt
file, and Visual Studio should stop complaining about the missing file (and the namespace, as a result)
Yeah, that did the trick, it can now build without problems.
Is the end result supposed to look like this?:
Gnome Server
* MilitaryController (Priority: 0)
* TestController (Priority: 0)
* WorldController (Priority: 0)
* GameController (Priority: 0)
* GnomeController (Priority: 0)
When I click any of those links I see No resource is available at the specified filepath: C:\Users\Temeez\Documents\My Games\Gnomoria\wwwroot\GnomeController
What URL are you using to access the server?
http://localhost:8081/
of course.
The server is designed to be flexible, so that anyone can build a website that will be hosted by the game. The server will host anything in the following directory:
C:\Users\<username>\Documents\My Games\Gnomoria\wwwroot
There are a few scenarios where it will fall back to the standard developer mode that you're seeing:
index
page is found, but I'd have to refer to the code to be certain.This primary use of this "feature" is to verify that the necessary controllers have been registered within the server. Fun fact: this particular "feature" is also in the CityServer
mod for Cities: Skylines.
I checked the README
, and there is yet another step that the current instructions don't even mention:
In the Solution Explorer, right click the on the
GnomeApp
project and select Publish. Use the following options:
- Publish method:
File System
- Target location:
C:\Users\<username>\Documents\My Games\Gnomoria\wwwroot
- Configuration:
Release
Once this is done, ensure that the
C:\Users\<username>\Documents\My Games\Gnomoria\wwwroot
directory exists.
Ah, well that explains it. It is all nice looking now, but the #gnome
view doesn't work. The responseText contains the following error:
<h1>An error has occurred!</h1><pre>System.IO.FileNotFoundException: Could not load file or assembly 'TypeLite, Version=1.3.1.0, Culture=neutral, PublicKeyToken=8cd4b9c9ac23d744' or one of its dependencies. The system cannot find the file specified.
File name: 'TypeLite, Version=1.3.1.0, Culture=neutral, PublicKeyToken=8cd4b9c9ac23d744'
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Boolean inherit)
at Newtonsoft.Json.Utilities.ReflectionUtils.GetAttributes(Object attributeProvider, Type attributeType, Boolean inherit)
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAssociateMetadataTypeFromAttribute(Type type)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.AddValue(TKey key)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.Get(TKey key)
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](Type type)
at Newtonsoft.Json.Serialization.JsonTypeReflector.GetAttribute[T](Object provider)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.AddValue(TKey key)
at Newtonsoft.Json.Utilities.ThreadSafeStore`2.Get(TKey key)
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting)
at GnomeServer.ResponseFormatters.JsonResponseFormatter`1.WriteContent(HttpListenerResponse response) in C:\Users\Temeez\Desktop\GnomeServer-master\GnomeServer\ResponseFormatters\JsonResponseFormatter.cs:line 21
at GnomeServer.IntegratedWebServer.HandleRequest(HttpListenerRequest request, HttpListenerResponse response) in C:\Users\Temeez\Desktop\GnomeServer-master\GnomeServer\IntegratedWebServer.cs:line 182
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
</pre>
At the very least, you're great at finding inaccuracies in the README
. :wink:
Try copying TypeLite.dll
into your Gnomoria directory.
Haha. ;)
Now it works like a charm, it's so awesome! I think this issue should stay open until you have the time to update the README
, or until I have the time to fork and pull request. This project is too interesting not to poke it. :)
I think this issue should stay open until you have the time to update the
README
I agree with that 100%. Proper documentation is crucial for things like this.
At any rate, I made a commit specifically to address this. Give it a look and let me know what you think. Feel free to close the issue if you think I covered everything, or let me know if you think it needs additional changes (or if I simply overlooked something).
There seems to be a problem with the Run Custom Tool
part. I have build the GnomeServer
project and then ran the custom tool on Interfaces.tt
, but it gives the following error.
Error Compiling transformation: Metadata file 'C:\Users\Temeez\Desktop\GnomeServer-master\GnomeApp\bin\GnomeApp.dll' could not be found GnomeApp C:\Users\Temeez\Desktop\GnomeServer-master\GnomeApp\app\models\Interfaces.tt 1
It did create the file GnomeApp\app\models\Interfaces.d.ts
, but in it is one line: ErrorGeneratingOutput
. I fail to see how to get over this problem.
Okay, I think I've figured it out.
GnomeApp\app\models\Interfaces.tt
Remove the following line (line 5, I believe):
<#@ assembly name="$(TargetDir)$(TargetFileName)" #>
GnomeApp
and select Properties
Release
Debug
.GnomeApp\app\models\Interfaces.tt
At this point, you shouldn't have any issues.
The line that is removed from GnomeApp\app\models\Interfaces.tt
(in step 2) caused the .tt
file to rely on the compiled output of the GnomeApp
project. Since the project settings for the GnomeApp
project prevented it from emitting any assemblies if even a single error was detected, the output assembly was never produced.
In short, the project failed to build because one of the files was missing a namespace, and the .tt
file (where this namespace was defined) failed to generate because it relied on the assembly of the project.
At any rate, I've pushed a commit (211d538daf88504ae6baed1b28c23e7c36bce997) that applies the steps above, which should prevent this from being an issue, but the steps above should fix it if you don't want to pull everything down again.
I pulled it again to properly test it, and it works now! Nicely done \o/
When trying to build the master branch, there is a lot of errors. Could this be because the Gnomoria RC version has gone up a few?