Xamarin forms: converted PCL to .net standard libraries and now I can't add new XAML pages - xaml

I recenty went through the process of converting all PCL's in my solution to .net standard libraries (not sure if its related nor not, just mentioning it in case).
Now, when I try and add a page, It adds the Xaml and the xaml.cs files into the project without any link or connection, so they wont compile:
Googling suggests I can go in and edit the .csproj to add a dependency between the two, but this is a horrible solution long term.
Any way to fix this "properly"?
I've tried dragging and dropping existing files in from windows explorer into VS2017, adding new through the add new dialog, adding existing through add existing and it all exhibits the same behaviour.
Thanks

OK, to answer my own question. Seems like you need to put in a workaround for the time being:
https://forums.xamarin.com/discussion/comment/288205/#Comment_288205
In the .csproj:
<ItemGroup>
<!-- https://bugzilla.xamarin.com/show_bug.cgi?id=55591 -->
<None Remove = "**\*.xaml" />
< Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<EmbeddedResource Include = "**\*.xaml" SubType="Designer" Generator="MSBuild:UpdateDesignTimeXaml" />
</ItemGroup>
And remove all existing XAML Pages referenced in the .csproj file such as EmbeddedResources and Compile directives

Related

SharePoint 2010 to 2013 SharePoint Migration issues

I recently migrated custom WebPart template solution (wsp), which has custom list definition, from SP2010 to SP2013 using Visual Studio 2013. Set the Assembly Version to 15 and compiled over .Net Framework 4.5. The deploymnet was successful. But there are 2 problems:
1. When I created site using the custom template that was just deployed, the page displays cluttered icons, attached screen shots. Also when trying to add permission to the site, a whole bunch of colorful cluttered icons appear on the site's Permissions page.
2. The other issue is, some of the CSS, specifically the ms-WPxxxxxxxx (like WPTitle, WPHeader etc) are being inherited, probably from corev4.css. That’s what View Source shows. The custom CSS is defined in the main page (CustomDefault.aspx) with “!important” tag, but that didn’t seem to be of any use.
The same solution was working perfect on SP2010.
Suspect mostly (1) is related to (2), I may be wrong.
To resolve (1), as advised by SP folks from MSDN Community forum, I changed the default master page to Oslo.master ==> that cleared the cluttering icons, but CSS and Javascripts werent working. So I had to revert.
I also tried changing the "../_layouts/.." to "../_layouts/15/..", that didnt make any difference.
MSDN Community Thread:
https://social.msdn.microsoft.com/Forums/office/en-US/f9199e0c-972b-45b9-b8fb-772028bc22d9/cluttered-icons-in-sharepoint-2013-post-migration-from-sp2010?forum=sharepointdevelopmentprevious#74fb3648-9776-4f68-82ba-b212102a1492
Any help will be appreciated.
enter image description here
After a long battle, I finally fixed this problem. Found that the 'onet.xml' in the SiteDefinition module was referring to SharePoint 2010 master page, v4.master. Since this was another project, I did not have a clue that this file will have references to SP2010 resources. Many blogs suggested only to change the resources path like '/_layouts/' to '/_layouts/15/' and the '/ControlTemplate/' to '/ControlTemplate/15/' but not seen anyone mentioning about master page change. Probably may not be the case for a completely out-of-box solution. So search for 'v4.master' (SP2010), in the project solution, if found, change it to your custom master page, if you have one, or to the default master page. But if you have used any other master page or a custom master page that was exclusively meant for SP2010 or an older version of SharePoint, you would have to choose an equivalent one or customize it to make it compatible with SP2013.
So here's the code snippet that was changed and that got rid of the cluttering icons, hope it helps someone out there.
<!-- <Configuration ID="-1" Name="NewWeb" MasterUrl="_catalogs/masterpage/**v4.master**" />
<Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="1" Name="Blank" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="2" Name="DWS" MasterUrl="_catalogs/masterpage/**v4.master**"> -->
<Configuration ID="1" Name="NewWeb" MasterUrl="~masterurl/**default.master**" />
<Configuration ID="0" Name="Default" MasterUrl="~masterurl/*default.master*">
<Configuration ID="1" Name="Blank" MasterUrl="~masterurl/**default.master**">
<Configuration ID="2" Name="DWS" MasterUrl="~masterurl/**default.master**">

Windows Store Apps : suppress "Common" folder generation?

I'm writing a Windows Store app, and I'd like to know if it's possible to suppress the generation of the "Common" folder, containing the code from Microsoft, which - imho I do not need.
Any ideas?
Cheers
Common contains StandardStyles.xaml which per App.xaml:
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
and in StandardStyles.xaml:
<!--
This file contains XAML styles that simplify application development.
These are not merely convenient, but are required by most Visual Studio project and item templates.
Removing, renaming, or otherwise modifying the content of these files may result in a project that
does not build, or that will not build once additional pages are added. If variations on these
styles are desired it is recommended that you copy the content under a new name and modify your
private copy.
-->
That said if you've determined it's not something you'll need just delete it, simpler and less fragile than hacking a T4 template (or whatever mechanism is used) for the code generation.

MSBUILD Generate xml documentation file for all projects in solution (without touching the projects)

I'm trying to create the XML documentation for all the projects in the solution even when the option its not checked in the project properties (and this is the key point).
I'm using TFS 2010 SP1 and tried with this "/p:TreatWarningsAsErrors=true /p:GenerateDocumentation=true" in the "MSBuild Arguments" field of my build definition. It doesn't generate anything.
I also tried with /p:DocumentationFile=foo.xml, which it does work but I assuming the file gets overridden by the last compiled project, so I tried using a variable instead but with no luck, I tried with
/p:DocumentationFile=$(Project).xml,
/p:DocumentationFile=$(localProject).xml
/p:DocumentationFile=$(localBuildProjectItem).xml
Is there a way to create the XML documentation for all the projects from within MSBUILD even though the option is not checked in the project?
PS: And yes I already see another thread similar to this but I don't want to modify the projects, that's the whole point of doing it with MSBUILD.
Thanks for your time
I also wanted to achieve this and finally I came up with a solution following these steps:
Create a Directory.Build.props file in the solution root folder.
Set GenerateDocumentationFile property to true.
Set DocumentationFile property.
By default you would use $(OutputPath) and $(AssemblyName) properties to set the documentation file name, like this:
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
But unfortunately this does not work as Directory.Build.props file is processed first hence properties set in .csproj files are unavailable at this point.
Fortunately there is another property that gets the current project name: $(MSBuildProjectName)
The output path by default is the following:
for Web projects: bin\
for other projects: bin\$(Configuration)\, e.g. bin\Debug\
To decide whether a project is a web project or not I used the name of the project which ends either with .Web or .WebApi
So the complete Directory.Build.props file looks like this in my case:
<Project>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- The rest is omitted for clarity. -->
</PropertyGroup>
<PropertyGroup>
<!-- warning CS1591: Missing XML comment for publicly visible type or member -->
<NoWarn>1591</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Web')) Or $(MSBuildProjectName.EndsWith('.WebApi'))">
<DocumentationFile>bin\$(MSBuildProjectName).xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="!$(MSBuildProjectName.EndsWith('.Web')) And !$(MSBuildProjectName.EndsWith('.WebApi'))">
<DocumentationFile>bin\$(Configuration)\$(MSBuildProjectName).xml</DocumentationFile>
</PropertyGroup>
</Project>
As you can see there is also a <NoWarn>1591</NoWarn> property set which tells the compiler not to produce warning messages for publicly visible types where XML document is missing.
Hope it helps.
Open your process template (i.e.: $/yourproject/BuildProcessTemplates/DefaultTemplate.xaml)
Scroll down to find the Compile the Project activity.
Add a new variable named DocumentationFile, type=String, scope=Compile the Project
Set its default value to:
String.Format("{0}.XML", System.IO.Path.GetFileNameWithoutExtension(serverBuildProjectItem))
Save changes and scroll down to Run MSBuild for Project activity.
In CommandLineArguments, set the following value:
String.Format("/p:SkipInvalidConfigurations=true {0};DocumentationFile={1}", MSBuildArguments, DocumentationFile)
Check-in the changes and build. This should generate the documentation even if it was not set by the project.

ItemGroup not picked up when publishing website via FTP

In my MSBuild, I created an item group, like the following:
<ItemGroup>
<SomeFileType Include="dir/file1.ext" />
<SomeFileType Include="dir/file2.ext" />
<SomeFileType Include="dir/file3.ext" />
</ItemGroup>
Then I try to publish the website via FTP. This item group above doesn't get picked up unless I change "SomeFileType" to "Content".
The reason why I want to use a custom name is that later in the build file I need to reference this collection of files using #(SomeFileType).
Do you have any idea to accomplish both uploading the files and being able to reference this group of items?
Thanks!
P.S. I also tried to add the following to make sure all the files can be picked up.
<Content Include="dir/*.ext" />
But this solution is not ideal. First, it covers all the files. Second, in my solution explorer, some files show up twice.
What happens if you try instead:
<Content Include="#(SomeFileType)" />
You get to still refer to them separately, and you aren't using a wildcard.
Try this to see if it prevents the files from showing up twice.
<Content Include="#(SomeFileType)">
<Visible>false</Visible>
</Content>

Adding a Compiler PreprocessorDefinitions in VS2010 C++ based on the value of %(Link->SubSystem)

I would have expected the following snippet of msbuild to work at the bottom of my .vcxproj files:
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions Condition='%(Link.SubSystem)'=='Windows'>SomethingWinSpecific;%(PreprocessorDefinitions)
</ClCompile>
</ItemDefinitionGroup>
except no matter what I do %(Link.SubSystem) is empty. I even printed out its value in various targets throughout a build and it appears to remain empty until the Link step begins. So my question is, is there any way to access the value of Link.SubSystem before the Compile step?
Link.SubSystem distinquishes between a Windows app and Console App, so Platform will not work.