Unity3d Project In App Purchases update yields errors - unity3d

I'm trying to update a Unity project that was built in version 2019.4.01f (Intel, LTS) to version 2021.3.10f (Apple Silicon, LTS). The reason is that I need update the In App Purchases package from Unity because Google Play requires that I update the billing library.
I already tried a bunch of options, but I keep getting errors. If I generate the GoogleTangle I get error CS0103: The name 'Obfuscator' does not exist in the current context. If I don't generate new tangles or copy the old tangles from the old path to the new one (according to the steps from here), I get other errors like: error CS0234: The type or namespace name 'Purchasing' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) and other similar errors. If I manually add some of the Purchasing assembly definitions I see no improvements.
Did anyone tried doing this recently?

The reason for the error was an Assembly definition. In order to allow PlayMode tests access to some of the game code I had an Assembly Definition in Assets/Scripts that was referenced in the PlayMode Assembly.
After removing the tests and the Assembly definition, the errors went away except for a new one that lets you know that you need to initialise Unity Services before initialising Purchasing (that's how Unity Purchasing works now).
This was a quick fix. The correct solution would be to keep the tests and use Assembly definitions in the folders that contain the code that PlayMode tests need to access. That will most probably lead to the need of Assembly definitions in other folders as well and at this point the code structure must be built in such a way that you don't get cyclic references between Assembly definitions.

Related

Unity Mirror not Importing correctly

I was following this tutorial https://www.youtube.com/watch?v=8VVgIjWBXks
about making a multiplayer game in unity using Mirror https://assetstore.unity.com/packages/tools/network/mirror-129321.
So obviously I went to the asset store and imported it... (I'm using unity 2020.1)
But now it's throwing a ton of errors and not letting me use "using Mirror;"
VSCode says: The type or namespace name 'Mirror' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]
Interestingly enough I can run the game without any issues even with all the errors but when I try in my code to "using Mirror;" it doesn't work
I tried reimporting and restarting the project, regenerating .csproj files, and even trying on different unity versions but nothing worked. I'm assuming that the Mirror package itself is totally fine but I'm doing something stupid....
Any idea what I could do?
This seems to be the problem:
Most likely the version of VS Code you have installed, reverting VS Code C# Extension from 1.23 to 1.22.
The short term fix involves literally deleting Mirror from Unity and re-importing it from the Package Manager. Also deleting *.vscode and *.SLN files.
A proper discussion about this issue is found at Omnisharp-vscode GitHub page.
I had to ensure player settings had scripting define symbols:
MIRROR
MIRROR_17_0_OR_NEWER

Unity C#, Using LINQ on multiple target platforms

Is there any way in Unity of defining resources for a particular platform that should be ignored by Unity when on another build platform?
I like to use LINQ, but when my target is the Web Player I get the error message:
error CS0234: The type or namespace name `Linq' does not exist in the namespace `System.Xml'. Are you missing an assembly reference?
I can solve this by copying the System.Xml.Linq.dll to my Plugins folder, and now Unity knows about LINQ.
Then when I switch target to Android I get the error message:
error CS0433: The imported type `System.Xml.Linq.XDocument' is defined multiple times
Which is resolved by deleting System.Xml.Linq.dll from the Plugins folder.
I'd like Unity to ignore System.Xml.Linq.dll when on Android and notice it when on Web Player target.
A solution for getting Unity to see LINQ when on Web Player platform without copying the DLL into the project, would also be fine.
Thanks in advance
there is this in the unity docs:
http://docs.unity3d.com/Manual/PlatformDependentCompilation.html

Build error with PostSharp 2.1.6 (NuGet)

I am evaluating PostSharp for a new project but cannot seem to get past the following error when I first build the project after changes:
Cannot copy file "C:\SourcePath\Output\Debug\MyApp.vshost.exe to
obj\Debug\Before-PostSharp\MyApp.vshost.exe: the file is locked by
process(es):MYAPP.VSHOST (8064)
The error only occurs in the first build attempt. If I immediately re-build, the error does not occur. I can only guess this is because the project isn't actually being rebuilt the second time.
I've read a few posts in the SharpCrafters forum that indicate this problem existed prior to v2.1 but was reportedly fixed. I am using v2.1.6.14 from NuGet (in VS 2010) and getting this error for every project I reference PostSharp. It is certainly not reasonable to require 2 builds every time, so I'm looking for a possible solution. I'm really pleased with what I've seen thus far but will have to go another direction if that can't be resolved.
UPDATE
Per Gael's request, I generated the diagnostic build log and sent it to him and it looks like he was able to resolve the problem in the latest release (2.1.6.14).
I believe part (or all) of the issue may be due to the fact that the build output for all of my projects is set to a common location (i.e. not the /bin/debug folder under each project). This is because we are using a MEF DirectoryCatalog which will discover Imports and Exports contained in the assemblies located in the output path. The PostSharp.targets file has the vshost.exe file excluded from the copy operation but only when it shares the name of the output assembly. In my case, the vshost.exe file has a different name and was, therefore, not being excluded.
The issue has been re-fixed in PostSharp 2.1.6.15.

Webconfig error with the site online

I'm trying to publish a web site.
The publication works perfectly, but when I try to access the address it returns me the following error:
Parser Error Message: Could not load
file or assembly
'Microsoft.Web.Helpers' or one of its
dependencies. This assembly is built
by a runtime newer than the currently
loaded runtime and cannot be loaded.
Source Error:
Line 293:
Line 294:
Line 295: Line 296:
Line
297:
Source File:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\web.config
Line: 295
Assembly Load Trace: The following
information can be helpful to
determine why the assembly
'Microsoft.Web.Helpers' could not be
loaded.
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].
This does not happen when I'm running on the local site.
The application was developed and Sql Server WebMatrix Compac 4
If you read the error message it says "Could not load file or assembly 'Microsoft.Web.Helpers' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." If you then look at the version of the ASP.NET that this site is attempting to run under, it is ASP.NET Version:2.0.50727.4209.
Web Pages and the Web Helpers library need Version 4.0. Make sure the site targets the correct version of ASP.NET.
For missing assemblies a simple solution is to just bundle them with your project.
Go to your project -> references -> find this microsoft web helpers ref -> open the properties panel and set Copy Local to True
Edit: Also try setting assembly binding logging.
I suspect that your web.config is fine and that there is an assembly missing from your deployment.
You probably have to include microsoft.web.helpers in your deployment package or simply copy it to the bin folder.
You might find that there are other assemblies missing but you should be able to pick them off one by one.
There is a previous question Hosting WebMatrix Page
that lists all of the dlls you have to deploy and also suggests using Webdeploy

Need help with MonoDevelop (solution for iPhone)

i try to make a solution with MonoDevelop, but i have some problems. I try to compile empty project, but there the builder shows:
Building: tusciasProjektas (Debug|iPhone)
Building Solution tusciasProjektas
Building: tusciasProjektas (Debug|iPhone)
Performing main compilation...
Updating CodeBehind files
Updated 1 CodeBehind files
The reference 'System' is not valid for the target framework of the project.
The reference 'System.Xml' is not valid for the target framework of the project.
The reference 'System.Core' is not valid for the target framework of the project.
Assembly 'monotouch' not found. Make sure that the assembly exists in disk. If the reference is required to build the project you may get compilation errors.
Build failed. Argument cannot be null.
Parameter name: path1
My computer is standart, with Intel CPU (not mac), it has Leopard X installed. I also installed framework for this and MonoDevelop. Maybe it's problem that i don't have installed MonoTouchSDK(it's require som user and password, and I can't download it from: http://www.go-mono.com/monotouch-download/monotouch-0.9-20090818-0.pkg ). Is anybody working on that and can help me with this?
It is stated on http://mono-project.com/MonoTouch_Beta that you have to fill out the beta participation form to get the SDK.
The MonoTouch team will send you the details to get started.
Assembly 'monotouch' not found.
You will need the MonoTouch framework to develop using the MonoTouch framework. The first thing you need to do is get that.
Have you followed the "join the beta" link on the project page? That would be a good place to start if you want an account to download it.
http://www.mono-project.com/MonoTouch_Beta