I stumbled upon the AMPathPopUpButton control in the Interface Builder, but every time I try to use it, the compiler notified me
Use of undeclared type 'AMPathPopUpButton'.
According to some search, it should be in the Automator framework. But after I import the framework, I still have no luck.
I suspect that this control may have been deprecated, however, it is still available in Interface Builder, and I couldn't find any information about its retirement.
Is it still usable in code? If yes, what should I import or do?
You should link against the Automator framework, and use a forward class declaration for the button type:
Go to your target's Build Phases and add Automator.framework to the Link Binary with Libraries build phase.
In your interface/implementation file that declares or references the AMPathPopUpButton type, use a forward class declaration instead of trying to import a header file:
#class AMPathPopUpButton;
Related
In my Xamarin.iOS project I need to reduce the assembly size (Apple's requirement for AppStore applications), and I need to turn on linker, setting the linker behavior either to "Link Framework SDKs only" or "Link All".
When I've selected "Link Framework SDKs only" in Linker behavior I get the compilation error upon building the project:
Can't resolve the reference 'System.Void System.Data.SqlClient.SqlCommandBuilder::DeriveParameters(System.Data.SqlClient.SqlCommand)',
referenced from the method 'System.Void DevExpress.Xpo.DB.MSSqlConnectionProvider::CommandBuilderDeriveParameters(System.Data.IDbCommand)'
in 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
To fix this issue all answers I have found recommendation to turn "Link All" option in the Linker behavior option.
When I've selected "Link All", the project compiles okay, but at the runtime I get system exception on the IoC Container code (type AAA does not implement the interface BBB), because I use reflection, and linker with "Link All" options affects the code with the reflection. And as far as I know this linker option (Link All) is not recommended for the projects where reflection is being used.
What options do I have at this point?
Linker configuration
I suspect your best option is to look at define a configuration file to tell the Linker what must be kept. There is a good set of documentation on Microsofts documentation site.
There are some other options but may not strictly apply in this case or you may wish to use a combination.
Preserve Attribute
You can provide extra definitions to the linker to ensure the type, methods and/or fields are not eliminated from your application. In your own code the preferred way is to use the [Preserve] custom attribute, as discussed in the Linking on iOS and Linking on Android guides.
Linking for each platform is certainly a possibility however I suspect that you want to preserve things in your shared project which is why I think the config file will be right for you.
This approach gives you the ability to define at varying levels (e.g. assembly or class level to keep everything or down to individual properties/methods, etc.).
Actually reference the bits you need kept
I dislike this option very much but some people find it quick and easy to either prove you can keep parts of the code or just accept it is a solution.
You essentially create a class of actual references to the methods/properties that you want to be kept.
public class LinkerPleaseInclude
{
public void Include(MyType arg)
{
arg.MethodIDontWantRemoved();
}
}
Note I have sourced some details from this site
I'm having staring issues with Module name spacing in a swift project.
I've tried this in a new project and everything works fine:
I have 2 modules with which contain the same class name and i'm able to reference the class from Module.Class no problem.
I have an existing swift project and I'm unable to get this working. I keep getting the error
So as you can see if I don't try to Module-Scope the class everything works fine.
(And yes i've tried with and with out the .Type addition).
So I'm assuming there is something off in my compiler setting. The only other thing I can think of is that my LocationMessage class is defined not in the main DataManager "class" file but rather in a different file.
But I really can't make heads or tails of whats going on. Any suggestions?
Project Structure
Framework: DataManager
DataManager.swift
LocationMessages.swift
Framework: ReferenceTest
File.swift
So my issue is that in File.swift I'm trying to reference a class defined in LocationMessages.swift inside the DataManager.framework The class IS public
#objc(DMLocationMessage)
final public class LocationMessage : ParsedMessage {
There is also this bug in swift compiler: SR-631 Extensions in different files do not recognize each other
The result (success/failure) of the compilation depends on the order of files in Build Phase > Compile Sources setting.
I had exactly the same error message: X is not a member type of Y. Solved it by rearranging compilation sources.
In case anyone is here while trying to build and use an xcframework, apparently, the issue is caused when you have a class in the framework which has the same name as the module/framework.
This is a known issue and needs a workaround as mentioned here.
P.S. - I know this doesn't answer this question per se. Just leaving it here for anyone else who might land here because of the question title.
If using xcframework follow below steps to get rid of error :
In terminal, go to the folder where .xcframework is located.
Run the following terminal command after replacing the frameworkName with your framework name:
find . -name "*.swiftinterface" -exec sed -i -e
's/frameworkName\.//g' {} \;
Replace the old xcframework in your project with xcframework generated with above command. Clean build the project.
The above error only occurs in xcframework when a class named is same as the module name. Details on Apple forum at: https://forums.developer.apple.com/thread/123253
You likely have a class/struct/enum DataManager anywhere in your code which hides the DataManager module. The error states that it cannot find LocationManager in type DataManager where it should read module instead.
Your app modules should be designed in a way so that you never need to explicitly use the module's name except for the import statement. So just use LocationMessage.Type directly without stating the module.
This is one reason all our app's modules are prefixed with an X, e.g. XDataManager. This avoids conflicts with Apple's modules, external modules (like from CocoaPods) and with types (like in your case).
The X also makes it obvious that these modules are part of the app itself and not some third-party frameworks.
When using an xcframework that depends on another framework, the X is not a member of type Y will also happen for the Framework it depends on when writing an extensions that wraps, for example, delegate methods
Example:
Framework Foo depends on Bar and need to conform to DataDelegate.
class Foo {
...
}
extension Foo : Bar.DataDelegate {
...
}
Everything during compiling will go as planned and the xcframework will be generated. Once you add it to your App along with the dependancy framework Bar and try to build it you will get DataDelegate is not a member of type Bar.
There is a workaround for this! 🎉
You should
Create a new empty swift file
Import just the type (not entire module) you need to use:
/* import MyModule */ // NOT THIS!
import enum MyModule.Theme // This will only import the `enum`. You can use this method for `class`, `structs` and others too.
Make a typealias for the imported type:
typealias MyUniqueName = MyModule.Theme
Use the new unique name that you just created.
This is the only workaround that compiler understand what do you mean exactly (without need to change the internal module names.
Result
Remember the final file will contain only two lines:
import enum MyModule.Theme
typealias MyUniqueName = MyModule.Theme
I'm new to TypeScript and, to some extent as an excerise, I'm trying to write the beginning of a type definition file for some of Adobe's "ExtendScript" APIs, which are based on ECMAScript.
Since the host environment isn't a browser, I have the same problem that the Node.js folk have in dealing with a cluttered namespace due to the still monolithic lib.d.ts file.
So far, it's not too bad. There is a definition for File in the global scope in lib.d.ts and the ExtendScript hosting environment also defines a File in the global scope. But the collision is minor and I can live with a couple of spurious methods polluting the File interface.
I'm still wondering if I could not rather just put a copy of lib.d.ts in my project, throw most of it out and tell the compiler to use that.
Is there a way to do that? I can't see any tsc compiler option to override the lib.d.ts. I also don't see where I would specify any custom compiler options in VS.
You can pass the --nolib flag to the TypeScript compiler to remove the lib.d.ts definitions from the compilation...
tsc --nolib app.ts
This will remove absolutely everything from the global scope, so you will have to define all everything you need to use, which in your case is probably exactly what you want.
You can create another file, say mylib.d.ts, and put necessary declarations there. TypeScript will merge interface declarations into one. For example:
// First.d.ts
export interface IProtocol {
method1(): string;
}
// Second.d.ts
export interface IProtocol {
method2(): string;
}
Will be merged into a single interface automatically and both methods will be available to IProtocol instances in your app.
You can even have declare method overloads in .d.ts files. The thing you cannot do in standard .ts files.
I created a VS 2010 class library. Marked the assembly for Com Visibility. Signed the assembly with a strong key. Created my class, have my entry point method available.
The library works fine from a test project in C#.
I regasm the class library to gac, via:
c:\windows\microsoft.net\framework\v4.0.30319\regasm testdll.dll /tlb: testdll.tlb /codebase
Include the tlb file as a reference in my VB6 project. I find it through resources 'browse' so its there.
When i try to instantiate the class... its empty. the public method that should be available via the public class doesn't show.
Dim objTest as testdll.testclass
set objTest = new testdll.testclass
objTest.testmethod <--- this 'testmethod' doesn't display in intellisense... nothing does.
In addition i tried calling the 'testdll.testclass' via CreateObject, i get the error "ActiveX component can't create object"
Now i have other projects i've done COM visibility for and i've tried comparing the difference, but i don't see any. I can't understand why it isn't working.
Any clues??? tx very much.
Just use an interface... one you define or to use the [ClassInterface(ClassInterfaceType.AutoDual)]
there are comments online you can find that indicate not to use autodual, but if you control the complete usage of your library, it seems like an 'ok' way to go.
I tried all sorts of ways to simulate / understand why my one project didn't need an interface to be visible by an vb project, without success. i had originally thought perhaps possible that it was because that project implemented an IDisposable Interface (the ONLY interface used in the C# projects that is com visible) but that didn't turn out to be the reason. Anyway I don't want to waste anyone else's time on this. thanks for the responses.
this link provides ample information on the subject:
http://anturcynhyrfus.blogspot.com/2011/03/creating-com-visible-c-component.html
I want to add my own project type based on IronStudio. So,
I downloaded the source for and compiled the latest version of IronPython, then
I created a new Visual Studio Package.
I added the Templates\Projects\MyProject folders, and added a file to it, and set its property "Include in VSIX" to true.
Then modified the main Package class to be derived from IronStudio's PythonProjectPackage instead, and set the ProvideProjectFactory property:
[ProvideProjectFactory(
typeof(PythonProjectFactory),
"Django Project",
"Django Project Files (*.myproj);*.myproj",
"myproj", "myproj",
#"Templates\Projects\MyProject",
LanguageVsTemplate="MyProject")]
public sealed class MyPackage : PythonProjectPackage
And ran it. But MyProject isn't showing up in the project templates. Why not?
The generated .pkgdef file looks like this:
[$RootKey$\InstalledProducts\VSPackage3Package]
#="#110"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"PID"="1.0"
"ProductDetails"="#112"
"LogoID"="#400"
[$RootKey$\Packages\{5cd7435c-7461-459f-80bc-c0c79e9d462f}]
#="Microsoft.VSPackage3.VSPackage3Package, VSPackage3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a4f1577d825253f8"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.VSPackage3.VSPackage3Package"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}]
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\Extensions]
"py"=dword:00000020
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\Editors\{888888c4-36f9-4453-90aa-29fa4d2e5706}\LogicalViews]
"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
[$RootKey$\CLSID\{888888fd-3c4a-40da-aefb-5ac10f5e8b30}]
#="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"InprocServer32"="$WinDir$\SYSTEM32\MSCOREE.DLL"
"Class"="Microsoft.IronPythonTools.Project.PythonGeneralPropertyPage"
"CodeBase"="$PackageFolder$\VSPackage3.dll"
"ThreadingModel"="Both"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
#="PythonProjectFactory"
"DisplayName"="My Project"
"DisplayProjectFileExtensions"="My Project Files (*.myproj);*.myproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="myproj"
"PossibleProjectExtensions"="myproj"
"ProjectTemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
"Language(VsTemplate)"="MyProject"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
#="My Project"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\Templates\Projects\MyProject"
[$RootKey$\Projects\{888888a0-9f3d-457c-b088-3a5042f75d52}]
#="PythonProjectFactory"
"DisplayName"="IronPython"
"DisplayProjectFileExtensions"="IronPython Project Files (*.pyproj);*.pyproj"
"Package"="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"DefaultProjectExtension"="pyproj"
"PossibleProjectExtensions"="pyproj"
"ProjectTemplatesDir"="$PackageFolder$\.\NullPath"
"Language(VsTemplate)"="IronPython"
[$RootKey$\NewProjectTemplates\TemplateDirs\{5cd7435c-7461-459f-80bc-c0c79e9d462f}\/1]
#="IronPython"
"SortPriority"=dword:00000064
"TemplatesDir"="$PackageFolder$\.\NullPath"
[$RootKey$\Services\{b98e41c4-581e-3532-beee-06829b683d39}]
#="{5cd7435c-7461-459f-80bc-c0c79e9d462f}"
"Name"="IPythonStarter"
I just want to get the bare bones up and running so I can start overriding some functionality (like the Add New Item dialog).
Update:
Reading my initial analysis once again increases my impression that some of the required components are missing (e.g. a dedicated ProjectFactory) and/or wired up incorrectly - from the MSDN documentation of the ProvideProjectFactoryAttribute Class:
ProvideProjectFactoryAttribute declares that a package provides a project factory.
And further:
If a VSPackage declares that it provides a project factory, it should create the factory and offer it to Visual Studio in the Initialize method of the Package-derived class.
You package is declaring to provide PythonProjectFactory, but (likely) doesn't offer it to VS, rather it is offered by the IronPython package. In turn you are providing arguments within the ProvideProjectFactory attribute list which PythonProjectFactory won't know about when asked for by VS.
Consequently you should at least provide a dedicated ProjectFactory yourself as per the walkthrough, wire up the classes accordingly and see how this turns out regarding the issues outlined below.
Initial analysis:
There appear to be several issues here at first sight - have you followed any tutorial on how to do this? In case, please note that some of those easily discoverable via search engines are outdated still. Either way I'd try working through and/or comparing your result with Walkthrough: Part 1 - Creating a Basic Project System from the MSDN documentation for VS 2010; please note that even this one is claimed to be outdated a bit according to the Community Content section on the bottom of the page.
Here is what I'd look into myself given the code you present, comparing with the walkthrough on the fly for more insights:
You realized already that the duplicate fragment starting with the GUID above PythonProjectFactory doesn't make sense - this is essentially trying to register two packages at once, which, even if allowed at all syntactically (which I doubt), can't possibly work like so due to both being registered with the same GUID [cross checking with the sample file in section Examining the Template Registration confirms this suspicion, as expected there is only one such fragment].
Please note that the GUID in question is the one identifying PythonProjectFactory (as per the respective source code), see below for more on this.
[Guid(PythonConstants.ProjectFactoryGuid)]
public class PythonProjectFactory : ProjectFactory {
Given .pkgdef is a generated file the next question is where this duplication/violation stems from. When two generated artifacts end up with the same GUID the respective definition in the sources is most likely messed up somehow, usually due to copy&paste duplication. Consequently you should verify whether {5cd7435c-7461-459f-80bc-c0c79e9d462f} is defined and referenced as intended, though here might be one or two other causes as well for this, see below.
A Package class needs to be identified by a GUID and the VS wizard generates some already in Guids.cs and references it accordingly on the class definition, however, the following is missing in your fragment [cross checking with the sample fragment in section To register the project template confirms this omission as well]:
[Guid(GuidList.guidMyPackagePkgString)]
public sealed class MyPackage : Package
Likewise it appears incorrect to derive MyPackage from PythonProjectPackage but reference PythonProjectFactory still rather than providing MyFactory as well (including a dedicated GUID), because the latter tells Visual Studio the location of your project template folder [see section Creating a Skeletal Project Factory]:
While it might well be possible to simply reuse all functionality from the base class PythonProjectFactory, inheriting is likely required simply because the factory must have a dedicated GUID too (as outlined in the walkthrough) in order to properly wire up the attribute specified data.
Likely unrelated, but still suspicious is that your two code blocks don't relate, as the Package class definition specifies Django Project Files (*.myproj);*.myproj, yet the result shows My Project Files (*.myproj);*.myproj.
Have you by chance mixed this from different builds or is this really a result of a clean one?
Good luck!
This stackoverflow posting might be helpful: VS2010: VSIX installation doesn't deploy item templates inside it
If this is not what you're looking for, try to see if you're missing something around the creation of custom project templates, I believe that's where the "missing link" is:
For VS 2008:
http://blogs.msdn.com/b/webdevelopertips/archive/2008/12/02/tip-32-did-you-know-how-to-easily-create-your-own-project-templates.aspx
For VS 2010:
http://blog.reybango.com/2010/09/21/how-to-create-html5-website-and-page-templates-for-visual-studio-2010/
and on MSDN:
http://msdn.microsoft.com/en-us/library/s365byhx.aspx
and here is how to create a project
template manually:
http://msdn.microsoft.com/en-us/library/ms185291.aspx
and here is how to create a new item template in VS 2010: http://msdn.microsoft.com/en-us/library/ms247113.aspx
Hope this helps
$PackageFolder$.\NullPath may have something to do with it.