Change Version in Package.appxmanifest in Xamarin UWP - xamarin

I want to change the value for Identity Version in below code
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" >
<Identity Name="Sample.Product " Publisher="CN=1234" Version="1.0.0.0" />
<mp:PhoneIdentity PhoneProductId="456" PhonePublisherId="0" />
</Package>
I tried changing using following XmlPoke code.
<XmlPoke XmlInputPath="Package.appxmanifest" Namespaces="<Namespace Prefix='n' Uri='http://schemas.microsoft.com/developer/vsx-schema/2011' Name='N' />" Query="/n:Package/n:Identity/#Version" Value="$(Version)" />
the line doesn't change the version.
Whats going wrong in above code?

Identity, which you're looking for, is in the default namespace of Package, so in your XmlPoke you'll need to use that namespace. To do that, change the URI of your XmlPoke to be http://schemas.microsoft.com/appx/manifest/foundation/windows10, like so:
<XmlPoke XmlInputPath="Package.appxmanifest" Namespaces="<Namespace Prefix='n' Uri='http://schemas.microsoft.com/appx/manifest/foundation/windows10' />" Query="/n:Package/n:Identity/#Version" Value="$(Version)" />

Related

VS2017 nuget keeps searching for packages in wrong location

So I migrated from nuget packages.config to PackageReference and found out there were some compatibility issues. I reverted the project to its working state (before the PackageReference) and now my project is not compiling.
I get the following error:
Severity Code Description Project File Line Suppression State
Error The package EntityFramework with version 6.2.0 could not be found in C:\Users\user.nuget\packages. Run a NuGet package restore to download the package. DbManager
This happened to multiple packages. It seems that Nuget is searching for packages in the user.net\package directory for some reason. Originally, there was a folder within the project that contained all the packages.
I forced the global path to be at the folder within the project by editing the NuGet.Config file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="C:\Projects\App\App Source\packages\" />
<add key="globalPackagesFolder" value="C:\Projects\App\App Source\packages\" />
</config>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
</configuration>
I don't know why Nuget keeps looking for packages at that location. It should be looking at the packages folder within the project.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net46" />
<package id="EntityFramework6.Npgsql" version="3.1.1" targetFramework="net46" />
<package id="Npgsql" version="3.2.7" targetFramework="net46" />
<package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net46" />
<package id="Z.EntityFramework.Plus.EF6" version="1.7.17" targetFramework="net46" />
</packages>
All of these packages in packages.config are not being found. This problem started happening when I tried PackageReference.
Is there any way to reset Nuget's settings? I would appreciate any guidance in solving this problem.
TLDR; This is caused by latent copies of the new project.assets.json file being left in your /obj/ folders. These can be safely deleted.
You can run this Powershell (at your own risk) in your root solution folder as a quick way to purge these files:
ls project.assets.json -Recurse | foreach {rm $_}
project.assets.json is generated for projects using PackageReference to cache the Nuget dependency graph for your project. It seems to confuse Visual Studio/Nuget if it's left there even if your project is using (or reverted back to using) packages.config
This can happen in Visual Studio 2019 as well, if you try PackageReference and then revert back to packages.config (or even if you switch between Git branches with one Nuget restore method versus the other).
Further Info
More info on project.assets.json here:
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build?tabs=netcore2x

Dotfuscator command exited with code 1 xamarin.ios

I am trying to use PreEmptive Solutions - Dotfuscator with my Xamarin.IOS app, but the build fails and I am getting this error:
I have done all the steps from here:
https://www.preemptive.com/obfuscating-xamarin-with-dotfuscator
My Xamarin.Android works fine, but the IOS project fails.
The error:
The command ""C:\Program Files (x86)\Microsoft Visual Studio 14.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition\dotfuscatorCLI.exe" /p:InDir="obj\iPhone\Release\DotfuscatorXamarin\dfin",OutDir="obj\iPhone\Release\DotfuscatorXamarin\dfout",ReportDir="DotfuscatorReports\iPhone\Release" "DotfuscatorConfig.xml"" exited with code 1.
Any idea how I can fix it?
Update 29-06-2017:
Content of DotfuscatorConfig.xml file for the Xamarin.IOS project
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
<dotfuscator version="2.3">
<propertylist>
<property name="InDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfin" />
<property name="OutDir" value="obj\iPhone\Release\DotfuscatorXamarin\dfout" />
<property name="ReportDir" value="DotfuscatorReports\iPhone\Release" />
</propertylist>
<global>
<option>monocompat</option>
</global>
<input>
<asmlist>
<inputassembly refid="7cf160e1-e28e-4f81-bd8d-f10fdcbcc3f8">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll" />
</inputassembly>
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
<inputassembly refid="11652964-9a02-4f24-b042-25f260fada88">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.iOS.exe" />
</inputassembly>
</asmlist>
</input>
<output>
<file dir="${configdir}\${OutDir}" />
</output>
<renaming>
<option>xmlserialization</option>
<mapping>
<mapoutput overwrite="true">
<file dir="${configdir}\${ReportDir}" name="Renaming.xml" />
</mapoutput>
</mapping>
<referencerulelist>
<referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
<referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
<referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
<referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
<referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
<referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
<referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
</referencerulelist>
</renaming>
<sos mergeruntime="true">
<option>version:v4</option>
<option>disable</option>
<option>dontsendtamper</option>
</sos>
<smartobfuscation>
<smartobfuscationreport verbosity="all" overwrite="true">
<file dir="${configdir}\${ReportDir}" name="SmartObfuscation.xml" />
</smartobfuscationreport>
</smartobfuscation>
</dotfuscator>
And for PreEmptive.Dotfuscator.Xamarin.targets file, I am using the one from the offical website.
PreEmptive.Dotfuscator.Xamarin.targets
As mentioned in the comments to the question, I work for PreEmptive Solutions.
This is a bug in the Dotfuscator-Xamarin targets file (PreEmptive.Dotfuscator.Xamarin.targets), so sorry about that.
Note: This issue has been corrected in version 1.1.0 of the targets file. The latest version of the file can be downloaded on this page.
Specifically, when generating the initial Dotfuscator config file (DotfuscatorConfig.xml), we were treating an MDB (Mono debug symbol) file as an input assembly.
The next version of the targets file will correct this issue.
To resolve this issue with version 1.0.0 of the targets file, please delete the following lines from DotfuscatorConfig.xml:
<inputassembly refid="2d40ee83-3b30-421c-8b1a-fa4d404fb2d9">
<option>honoroas</option>
<option>stripoa</option>
<option>library</option>
<option>transformxaml</option>
<file dir="${configdir}\${InDir}" name="MyProject.dll.mdb" />
</inputassembly>
The targets file will use your corrected version from then on.

Windows 10 IOT Foundation namespace is missing IOT

We are trying to add iot capabilities to our Package.appxmanifest for a cordova project. Visual studio complains that the capability we are trying to use cannot be found nor is it a child of the foundation name space.
The underlined iot:Capability shows the following when hovered over:
The element 'BackgroundTasks' in namespace 'http://schemas.microsoft.com/appx/manifest/foundation/winows10' has invalid child element 'Capabilities' in namespace 'http://schemas.microsoft.com/appx/manifest/iot/windows10'. List of possible elements expected: '...
The thing is I created this as a new project and let vs do all the work yet it cannot resolve it's own entries it's creating. We see this with both a new C# and JS project that VS generated. Can anyone help us? (Yes we added the references "Windows IoT Extensions for the UWP" 10.0.10586.0 to the project as well.). FYI We get the same error when adding as well.
Here's the package.appxmanifest:
<?xml version='1.0' encoding='utf-8'?>
<Package IgnorableNamespaces="uap mp iot" xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10">
<Identity Name="com.project.syndication.sitepad" Publisher="CN=$username$" Version="2.0.0.0" />
<mp:PhoneIdentity PhoneProductId="a885d1d0-453e-11e6-a59d-550bfa336405" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>SitePad App</DisplayName>
<PublisherDisplayName>ERT</PublisherDisplayName>
<Logo>images\StoreLogo.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily MaxVersionTested="10.0.10586.0" MinVersion="10.0.10586.0" Name="Windows.Universal" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="com.project.syndication.sitepad" StartPage="ms-appx-web:///www/index.html">
<uap:VisualElements BackgroundColor="#464646" Description="CordovaApp" DisplayName="SitePad App" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png">
<uap:SplashScreen Image="images\splashscreen.png" />
<uap:DefaultTile ShortName="SitePad App" Square310x310Logo="images\Square310x310Logo.png" Square71x71Logo="images\Square71x71Logo.png" Wide310x150Logo="images\Wide310x150Logo.png" />
</uap:VisualElements>
<uap:ApplicationContentUriRules>
<uap:Rule Match="ms-appx-web:///" Type="include" WindowsRuntimeAccess="all" />
</uap:ApplicationContentUriRules>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<uap:Capability Name="picturesLibrary" />
<iot:Capability Name="systemManagement" />
</Capabilities>
</Package>
The hovering error looks like a bug with something(VS?), I'm seeing it multiple times, yet my code still compiles and runs OK.
No worries on this.

Changing Wix background

Hi and hello to everyone. I've been trying to edit or rather change the background of my installer which I created using Wix. Take note that this is my first time and I have no idea completely when it comes to XML and also in WIX. Kindly advice and help. Thanks.
I have this code which I found on another site.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject2" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="628c5ddd-baee-48ba-8b16-bad2cb70862b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SetupProject2" Level="1">
</Feature>
<UIRef Id="WixUI_InstallDir"/>
<Binary Id="Idnumber1" SourceFile="img\banner.png" />
</Product>
Thanks for the help.
If you are trying to use this line
<Binary Id="Idnumber1" SourceFile="img\banner.png" />
to set the background then that's your problem.
If you are setting the background you want to use the WixUIDialogBmp variable.
<WixVariable Id="WixUIDialogBmp" Value="path to your bmp"/>
Additionally as you can see here all the images need to be bitmaps. The file in your example is a png, the WixUIDialogBmp will also need to be 493 x 312.
Also WixToolSet has lots of good walk-throughs and guides, in addition to the documentation.

How to add a nuget package in a MVC3 project template

I'm trying to hack a MVC 3 project template to automatically install elmah via nuget.
Since MVC 3 Tools update, MVC3 project templates contains this section :
<WizardData>
<packages>
<package id="jQuery" version="1.5.1" />
<package id="jQuery.vsdoc" version="1.5.1" />
<package id="jQuery.Validation" version="1.8.0" />
<package id="jQuery.UI.Combined" version="1.8.11" />
<package id="EntityFramework" version="4.1.10331.0" />
<package id="Modernizr" version="1.7" />
</packages>
</WizardData>
So i've tried to add elmah package like this :
<WizardData>
<packages>
...
<package id="elmah" version="1.2.0.1" />
</packages>
</WizardData>
I've also downloaded and added elmah.1.2.0.1.nupkg file in
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Packages
folder along with default packages (jQuery.1.5.1.nupkg, EntityFramework.4.1.10331.0.nupkg etc...)
Unfortunately, i keep having this error when i create a new MVC3 project :
(source: free.fr)
Does anyone knows how to solve this error?
At least is it something feasible with this version of mvc3 tools ?
I just blogged about how to do this: http://haacked.com/archive/2011/06/06/creating-a-custom-asp-net-mvc-project-template.aspx
This walks through creating and registering a custom project template.

Resources