I need to add a Reference to a API in our multiplaform project for WinRT. If I add the reference it conflicts with the other plaforms - Win32 for example.
Is it possible to add a reference and make it invisible to other platforms somehow?
To solve this problem one needs to manually edit the project and add the necessary conditions to their project files by hand.
For example:
<ItemGroup Condition="'$(Platform)'=='Win32'">
<SDKReference Include="Chat API, Version=8.0" />
</ItemGroup>
I've been told by MS that they do not intend to add GUI support for SDKReferences.
Related
I am attempting to create a binding project for the StripeTerminal CocoaPod (Stripe Terminal iOS). I setup the pod file. Then using the Xamarin docs, I installed Objective Sharpie, and used
sharpie pod bind
which created two files. StripeTerminal_ApiDefinitions.cs and StripeTerminal_StructsAndEnums.cs. Those files look good and have the methods I am expecting when I was using a XCode project.
I then pointed added a Native Reference to the StripeTerminal framework file, but it seems a link file was not created. The Xamarin help documentions mention that a iOS Native Library ends in .a, while this framework does not. I tried pointing the native reference to the folder of the framework, to the extensionless library, and even renamed the library project to .a. Each time when I attempt to build it gives me an error of "No API definition file specified".
Your API definition file(s) should have a build action of ObjcBindingApiDefinition:
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
</ItemGroup>
And your Enum|Structs file(s) should have a build action of ObjcBindingCoreSource:
<ItemGroup>
<ObjcBindingCoreSource Include="Structs.cs" />
</ItemGroup>
I am writing a Visual Studio 2010 property sheet to integrate a complex 3rd party C++ library.
To determine what pieces of the library I need to link to my projects (as well as configuring various defines, includes, directories, etc.), my property sheet needs to determine the project's currently configured C runtime library (i.e. "MultiThreaded", "MultiThreadedDebug", "MultiThreadedDLL", or "MultiThreadedDebugDLL").
However, as a substantially similar question here on stackoverflow pointed out, this MSBuild conditional does not work:
Condition = " '$(RuntimeLibrary)' == 'MultiThreadedDLL' "
Another option was provided, but it was for a subsequent build task. I need this value before ever getting to the build.
I've also scoured Google and Microsoft's MSDN website looking for a way to get this value and have come up empty. Any ideas?
Since there was no way via MSBuild's XML to directly get the configured runtime library, I regex'ed the project file. Here is the XML PropertyGroup snippet to do this:
<PropertyGroup Label="UserMacros">
<RuntimeLibraryRegex>
<![CDATA[<ItemDefinitionGroup Condition=".*']]>$(Configuration)\|$(Platform)<![CDATA['">(?:.*\n)*?.*<RuntimeLibrary>(.*)</RuntimeLibrary>(?:.*\n)*?.*</ItemDefinitionGroup>]]>
</RuntimeLibraryRegex>
<RuntimeLibrary>
$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText($(MSBuildProjectFullPath))), $(RuntimeLibraryRegex)).Result('$1'))
</RuntimeLibrary>
</PropertyGroup>
Now the Condition statement in the question will work as-is.
Also, please note that this MSBuild property group XML does not take into account runtime library default (e.g. if the project doesn't have the runtime library set) but can be made to easily.
I am facing unknown problem while using Prism 4. We implement business solution in MVVM pattern. For that I have used
1. Microsoft.Expression.Interactions
2. System.Windows.Interactivity
3. GalaSoft.MvvmLight.Extras.WPF4
for Interaction.Triggers, CallMethodAction and EventToCommand.
<SWI:Interaction.Triggers>
<SWI:EventTrigger SourceObject="{Binding ElementName=txtName}" EventName="GotFocus">
<MEI:CallMethodAction TargetObject="{Binding Path=DataContext,ElementName=txtName}" MethodName="txtName_GotFocus"></MEI:CallMethodAction>
</SWI:EventTrigger>
<SWI:EventTrigger SourceObject="{Binding ElementName=txtName}" EventName="KeyUp">
<GMEWCMD:EventToCommand Command="{Binding Path=DataContext.cmdtxtNameKeyUpEvent,ElementName=txtName}" PassEventArgsToCommand="True">
</GMEWCMD:EventToCommand>
</SWI:EventTrigger>
</SWI:Interaction.Triggers>
Everything is working fine but now we required to make whole system loosely couple we choose prism 4. We already achieved this but above code create following problem as below.
Could not load file or assembly 'Microsoft.Expression.Interactions, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
If I comment above code everything is working fine. I don't know what an issue. Does PRISM 4 not support above assemblies?
Please help us to get rid from this problem.
Thank you
This commonly happens to me when I reference both Microsoft.Expression.Interactions and System.Windows.Interactivity in a view that belongs to a module, but I fail to also add those references to the project that acts as the shell.
I had a similar problem with Prism in Visual Studio 2012. The XAML editor would fail with the same exception.
The solution was to install Microsoft Expression Blend SDK. The assembly should be part of SDK. Allegedly, it is necessary for binding between control events and commands in XAML and some code may require it.
I had the same problem during a Prism 6.1 composite app using .NET 4.5.2, where i was referencing in one of the modules (class library) the Microsoft.Expression.Interactions & System.Windows.Interactivity.
Eventually i had to reference the same dlls in the Desktop project (where bootstrapper and Shell belong)
We upgraded our .net 3.5 projects (c#) to .net 4.0. When you look at the project file there are two tags that I'm trying to make sense out of:
<RequiredTargetFramework>3.5</RequiredTargetFramework>
<TargetFrameworkVersion>4.0</TargetFrameworkVersion>
Why are there two seemingly similar tags with different values?
The <RequiredTargetFramework> element was already present in your 3.5 project. It's associated with the assembly <Reference> and only present on assemblies that are not available in .NET 2.0
I don't buy much stock in the single mention of it in MSDN, I don't see how batch building has anything to do assembly references. Nor is it used in any of the 3.5 MSBuild .target files. I think the IDE simply uses it to put the warning icon next to the reference in the References node when you change the Target Framework to a version less than what's needed to support the assembly.
There are other elements like this in a project file that don't affect MSBuild but have an effect in the IDE. Like <SubType> and <DependentUpon> in the <Compile> element.
Have you found this one link? link text. TargetFrameworkversion is easy, that's the one you can change in the project properties to say which framework to build against. The article says that RequiredTargetFramework is used to batch items (but it's still not clear on it' real purpose other than it's not used a lot)
batches the Reference items by their RequiredTargetFramework metadata. The output of the target looks like this:
Reference: 3.5;3.5
Reference: 4.0
Target batching is seldom used in real builds. Task batching is more common. For more information, see MSBuild Batching.
I'm getting used to the new IDE (it's vc# express), but the first contact is somewhat confusing. When I open the Add Reference dialog and switch to the .NET tab, a label above the assembly list states: "Filtered to:.NET Framework 4". And it's true - I can reference .NET 4.0 assemblies only plus things like XNA 3.1. However I can't see older assemblies i.e. Managed DirectX libs, which are obviously installed on my computer as there was no trouble with adding a ref to them in vc#08.
What is this? How to change the filter? The label is read-only. These sound like dull guy's questions, but I'm out of luck in finding an answer and there is no intuitive solution.
Thanks in advance.
Change your new application to target the .NET Framework 4 and not .NET Framework 4 Client
"When you create a new application, some projects target the .NET Framework 4 Client Profile by default."
http://msdn.microsoft.com/en-us/library/cc656912.aspx
"If you are targeting the .NET Framework 4 Client Profile, you cannot reference an assembly that is not in the .NET Framework 4 Client Profile. Instead you must target the .NET Framework 4. "
We've created a tool that will help you to achieve your goal. Muse VSReferences will allow you to add a Global Assembly Cache reference to the project from Add GAC Reference menu item.
Regards
s
How to change the filter?
Very simple - you must change the Target .NET Framework for your project, as whole. It's not pain :) just RMB on project name in Solution Explorer->Properties->Application tab->Target Framework(combobox). Select what you want. Change combobox == change filter in Add Reference dialog. ;)
I was having a similar problem until I noticed that the older .NET assemblies were actually in the list, there's just some really strange sorting going on. If you sort by assembly name, you should see them in the proper order.
Another possibility is to go into your project’s Properties page and change the Target Framework from 4.0 to your desired Framework. You will then need to reload you application. Now your Reference should be there. Once you have added the Reference you want, change back to 4.0 and again reload.
Hope this helps.
If, for instance, your project is Framework 4 and you want to reference say Microsoft.Deployment.WindowsInstaller (which is not in the filtered list of the .NET tab), then go to the Browse tab and enter the path to the reference item e.g. C:\Program Files\Windows Installer XML v3.5\SDK\Microsoft.Deployment.WindowsInstaller.dll