UWP App deploy error - c#

I have two versions of one application in one project/solution with only one difference - app name.
After installation one of them, the second app cant deploy:
2>Deploying to Phone Internal Storage...
2>Updating the layout...
2>Copying files: Total <1 mb to layout...
2>Checking whether required frameworks are installed...
2>Registering the application to run from layout...
2>DEP0001 : Unexpected Error: -2147009287
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========\
Is there any unique data in Package.appxmanifest or Package.StoreAssociation.xml which should be changed ?

Yes, you need to change the Package.appxmanifest for each app.
In general you need a different Package Family Name for each app you install.
When deploying to a phone things are slightly different. The phone uses an Id for each installed app. This is defined as the PhoneProductId attribute of the PhoneIdentity element in the Package. You need to edit the XML directly to change this. (Right click the file, select 'Open With...' and then select a suitable editor.)
If you're distributing through the store then the project will be associated with the store and so changing the name will not be sufficient to create a new store entry. You'll need a different store association for each entry in the store.

Related

Error Metadata file dll could not be found CSC when publishing

I have a Visual studio solution with several projects in it, specifically a DotNet5 asp.net app, that has several netstandard 2.0 references on it. it builds and runs fine in the debugger but continuously throws the metadata errors. It keeps specifically referencing its looking for a net5 folder in the netstandard2 project. I cannot find where its getting this from, the problematic one used to be a multitargeted project against framework 4.7, 4.8, and net5.0, but i got annoyed with the multiple dll's and just migrated it to standard2.0 and had no issues till i want to publish it.
I've tried what a few other questions referenced, cleaning, rebuilding, remove and re add references to other projects, deleted the obj and bin folders out of the solution, the removing the sou file, tried VS 2019 (16.9.0 preview 2) preview vs 2019 (16.8.3) release, different computer (pulled back down from a lan git repository) and got the same error.... also tried searching the entire solution for references to net5.0 and didn't find it outside of the expected locations like the csproj for the asp.net project and its respective pubxml. And just for fun, I temporarily retargeted the library project back to net5.0 and it still threw the same error even when the exact file and path listed did exist.
Using enters for the error below for the different columns in the error message, and removed the "sensitive" info. There is no error code provided by Visual Studio. Anyone else got any more ideas on what to try?
Error
Metadata file 'C:\Users\UserName\source\repos\Solution\Project 2\bin\Release\net5.0\ref\Project 2.dll' could not be found.
Project 1
CSC
0
Edit: adding a couple other sections of the error messages:
1/2/2021 7:38:55 PM
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
===================
And the end of the output window since full thing is a bit too long. still can't figure out where its getting the net5.0 for the one project reference
/reference:C:\Users\UserName\.nuget\packages\system.xml.xpath.xmldocument\4.0.1\ref\netstandard1.3\System.Xml.XPath.XmlDocument.dll /reference:C:\Users\UserName\.nuget\packages\mysql.data\8.0.22\lib\net5.0\Ubiety.Dns.Core.dll /reference:"C:\Users\UserName\source\repos\CheckNotes\Project 3\bin\Release\netstandard2.0\Project 3.dll" /reference:"C:\Users\UserName\source\repos\CheckNotes\Project 2\bin\Release\net5.0\ref\Project 2.dll" /reference:C:\Users\UserName\source\repos\CheckNotes\Project 4\bin\Release\netstandard2.0\Project 4.dll /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll" /reference:C:\Users\UserName\.nuget\packages\mysql.data\8.0.22\lib\net5.0\Zstandard.Net.dll /debug+ /debug:portable /filealign:512 /optimize+ /out:"obj\Release\net5.0\CheckNotes Web - Core.dll" /refout:"obj\Release\net5.0\ref\CheckNotes Web - Core.dll" /target:exe /warnaserror- /utf8output /deterministic+ /langversion:9.0 /analyzerconfig:"obj\Release\net5.0\CheckNotes Web - Core.GeneratedMSBuildEditorConfig.editorconfig" /analyzerconfig:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\analyzers\build\config\AnalysisLevel_5_Default.editorconfig" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Mvc.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk.Web\analyzers\cs\Microsoft.AspNetCore.Components.Analyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll" /analyzer:"C:\Program Files\dotnet\sdk\5.0.200-preview.20601.7\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll" Controllers\AssemblyController.cs Controllers\CheckNotesController.cs Controllers\ContactsController.cs Controllers\CustomerController.cs Controllers\HomeController.cs Controllers\ImageController.cs Controllers\OperatorPagesController.cs Controllers\PalletsController.cs Controllers\SharedController.cs Controllers\StatisticsController.cs Models\ControllerClass\ctrlrAssembly.cs Models\ControllerClass\CtrlrCheckNotes.cs Models\ControllerClass\ctrlrContacts.cs Models\ControllerClass\CtrlrCustomer.cs Models\ControllerClass\CtrlrOperatorPages.cs Models\ControllerClass\CtrlrPallet.cs Models\ControllerClass\ctrlrStats.cs Models\DataClass\AppSettings.cs Models\ErrorViewModel.cs Models\renderAction.cs Program.cs Startup.cs "obj\Release\net5.0\.NETCoreApp,Version=v5.0.AssemblyAttributes.cs" "obj\Release\net5.0\CheckNotes Web - Core.AssemblyInfo.cs" "obj\Release\net5.0\CheckNotes Web - Core.RazorAssemblyInfo.cs" /warnaserror+:NU1605
CSC(0,0): Error CS0006: Metadata file 'C:\Users\UserName\source\repos\CheckNotes\Project 2\bin\Release\net5.0\ref\Project 2.dll' could not be found
10>Build failed. Check the Output window for more details.
========== Build: 9 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========
Got it to publish but I am so confused....something to do with the publish profile. If i delete that and generate a new one, works fine. as soon as i edit it using the GUI, broken....generate it again. So far seems ok to edit it manually but TBD. not sure if the "fix" will survive restarting Visual studio or not.
Edit - Scratch that, found the difference.
Remove the following line in Properties/FolderProfile.pubxml and it's fine.
<TargetFramework>net5.0</TargetFramework>

UWP : SignTool Error: Access is denied. ( Resolve ! )

This is re-Question about issue "SignTool Error: Access is denied." on my visual studio.
When I compile "SideLoad" application on Visual Studio 2017. This error happened again.
This is not first time for me. Previously, I could not resolve this error. Then, I bought New DELL PC :( Yes, During some period, It worked fine without any problem. but I saw same error again, Today !
Here is some additional information.
x64, Windows 10, Os ver 1703 , Build 15063.675.
Visual Studio 2017
This is new PC. Administrator, Local user, not MSN user.
Target version : Windows 10 Creator Update ( 10.0; Build 15063 )
Min version : Windows 10 November Update ( 10.0; Build 10586 )
After build of side load applicaiton, This error show ::
1> Bg7Uwp1 -> D:\develop\visualstudio2\xxx\Bg7Uwp1\Bg7Uwp1\bin\x86\Release\Bg7Uwp1.exe
1> Processing application code
1> Computing application closure and generating interop code
1> Loading 108 modules...
1> Generating code...
1> Interop code generated.
1> Generating serialization code
1> Compiling interop code
1> Generating System.Reflection.DispatchProxy proxy code.
1> Cleaning up unreferenced code
1> Generating native code
1> Generating fixups for native code
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(3787,5): error APPX1204: Failed to sign 'D:\develop\visualstudio2\xxx\Bg7Uwp1\Bg7Uwp1\bin\x86\Release\Bg7Uwp1_1.0.9.0_x86.appx'. SignTool Error: Access is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(3787,5): error APPX1204: SignTool Error: An error occurred while attempting to sign: D:\develop\visualstudio2\xxx\Bg7Uwp1\Bg7Uwp1\bin\x86\Release\Bg7Uwp1_1.0.9.0_x86.appx
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\AppxPackage\Microsoft.AppXPackage.Targets(3787,5): error APPX1204:
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Package: 0 succeeded, 2 failed ===========
========== App Bundle: 0 succeeded, 1 failed ===========
Please give me some idea. I tried everything from internet and here. but Previously, I could not resolve.. I can not buy new PC again !
Update 1
and After this trouble, I open new Uwp project and start sideload compile. it show same error ! This is same situation with previous PC ! Now, My Vs2017 can not make sideload for an
empty UWP project !!
in previous PC, I tried everything. Re-install VS2017, Re-install NuGet items. but it did not resolve at all. Only way was to buy new PC and re-install VS.
Update 2
With verbose mode of VS2017 compile output, I found , There is signtool.exe in SignAppxPackageExeFullPath=C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\signtool.exe
with it, I tried to sign by myself.
Open command prompt tool with Admin
Run below command. I success to sign !??
Update 3
Next challenge is to add "Admin privilege" with "Signtool.exe" like this. but this was failed. Error was changed. "It need administrator privilege" and it make build error. not success.
Question
If I do sign manually, Is it enough ?
I signed with manual ( target file is : Bg7Uwp1_1.0.19.0_x64.appx ) "c:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\signtool.exe" sign /fd SHA256 /a /f Bg7Uwp1_TemporaryKey.pfx bin\x64\Release\Bg7Uwp1_1.0.19.0_x64.appx
Done Adding Additional Store
Successfully signed: bin\x64\Release\Bg7Uwp1_1.0.19.0_x64.appx
I copy all "Release" folder to other PC.
I copy "Bg7Uwp1_TemporaryKey.pfx" to other PC too.
On 2nd PC, I install the certification key first "Bg7Uwp1_TemporaryKey.pfx". Success.
I tried to install with clicking Bg7Uwp1_1.0.19.0_x64.appx
I can not installed : (
Either you need a new certificate installed for this app package, or you need a new app package with trusted certificates. Your system administrator or the app developer can help. A certificate chain processed, but terminated in a root certificate which isn't trusted (0x800B0109)
Find! a solution but Not perfect yet.
with above error, I read this.. This is a step to install sideload application to PC. I follow this. I can resolve the error 0x800B0109.
In File Explorer, right-click on the app package, and in the pop-up context menu select Properties.
In the Properties dialog, select the Digital Signatures tab.
In the Signature list, select the signature and then click the Details button.
In the Digital Signature Details dialog, click the View Certificate button.
In the Certificate dialog, click the Install Certificate… button.
In the Certificate Import Wizard, select Local Machine and then click Next. You will need to grant administrator privileges to continue.
Select Place all certificates in the following store and browse to the Trusted People store.
Click Next, then click Finish to complete the wizard.
after this step, I can install my Sideload to my Own PC. but To install 2nd PC has error. ( New error 0x80073CF3 ) . but I get big improvement !
Update 4 ( Not resolve still ! )
Now, TO install other PC is not impossibile. Dependencies file can not create by VS. because signtool has error.I have to install other PC. Without it, All my time would be waste.. :( please help me...
This is old dependencies files. I have to make it for my ver 19.
Update 5
I check What Vs2017 is doing in background. I used ProcessMonitor. and She execute this command. It look like no problem. I tried with Admin-MS-prompt, It success.
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64\signtool.exe" sign /fd sha256 /f "Bg7Uwp1_TemporaryKey.pfx" "D:\develop\visualstudio2\shinwatec\Bg7Uwp1\Bg7Uwp1\bin\x64\Release\Bg7Uwp1_1.0.19.0_x64.appx"
but Without Admin, I got same error with VS2017 !
I found the solution ! and fix it.
with ProcessMonitor, I found this line.
signtool.exe has "Access denied" to access %appdata%\local\Temp
I check the folder permission. There is no permission on the Temp folder. I added my own user Networkname\username .
After this. I success to fix this issue. Now my visualStudio 2017 can make sideLoad application ! Yes, I do not need to buy new PC again :)
thank you. Mr. BugFinder.

How to see which projects/why failed to build VS 2015

Simple question , after build i have the following :
========== Build: 68 succeeded, 5 failed, 1 up-to-date, 0 skipped ==========
Now , i do not have any errors(which means my error list in VS shows 0 errors) , how do i know which projects and why fail to build ?
Yeah VS 2015 doesn't show errors at times or show errors that were already fixed.I don't know why. Our solution also had around 70 projects
So What i used to do was to check the Build Log in Output tab. This will have the log of each project including errors if any. Or do MsBuild from Msbuild command prompt of VS 2015. Easy to identify the issue.

Windows 10 System.Exception: Install failed. Please contact your software vendor

I'd like to create 2 apps from the same project(VS solution), both of them has the same functional with small differences. So I just made 2 copies of my solution and I changed solution name, namespace and asigned app to different Microsoft Store app. When I try to instal secnod app on phone I get:
2>caught exception: System.Exception: Install failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CF9)
2> at Windows.Foundation.IAsyncOperationWithProgress`2.GetResults()
2> at Microsoft.VisualStudio.ImmersiveProjectServices.PlatformShim.AppxCancelableDeployOp.Microsoft.VisualStudio.ImmersiveProjectServices.PlatformShim.IAppxCancelableDeployOp.Execute()
2> at Microsoft.VisualStudio.ImmersiveProjectServices.Shared.AppxLayoutManager.RunDeployOpWithCancel(IAppxCancelableDeployOp deployOp, CancelManager cancel)
2> at Microsoft.VisualStudio.ImmersiveProjectServices.Shared.AppxLayoutManager.RegisterPackage(String location, DeployPackageName deployPackageName, CancelManager cancel)
2> at ImmersiveDeploy.Program.ExecuteTask(String[] args, Int32 argument, XDocument immersiveDeployResults, ImmersiveDeployTask task, DeployPackageName deployPackageName)
2> at ImmersiveDeploy.Program.Main(String[] args),
2>
2>*** End of logging from deployment agent ***
2>Error : DEP0001 : Unexpected Error: Install failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CF9)
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
Projects build report:
Status | Project [Config|platform]
-----------|---------------------------------------------------------------------------------------------------
Succeeded | BackgroundTaskRawNotification\BackgroundTaskRawNotification.csproj [Debug|x86]
Succeeded | MySolution\MyApp.csproj [Debug|x86]
Failed | MySolution\MyApp.csproj [Debug|x86]
As is mentioned in other questions, if I uninstall one of them, the second is installing but I'd like to made some changes to install both of them. Have to mention that on PC I can install both apps from Visual Studio with no errors.
I am using:
Windows 10 Pro
Visual Studio Version 14.0.24720.00 Update1
Mobile Emulator 10.0.10240.0
Any advices are appreciated.
P.s. In android we have gradle flavors that helps us to build different apps from the same Android Studio project, maybe there is something similar in Visual Studio?
The purpose of reserving multiple names for an App is that the name has meaning for different languages. E.g. an English speaking person would understand "My Great App" and a German speaking e.g. "Meine tolle App". When you assign multiple names to the same App which is identified by it's ID you do not have two Apps but just one with multiple names. That is why you're getting the error.
You could try to change these IDs manually but the easiest, fastest and safest way would be to just let Visual Studio do the work by creating a new project and copy/paste/include your files.
Anyway if your intention is to create a "Free" and a "Pro" version you should consider doing it the recommended way and use in App purchases or create a trial version.
In the package.appxmanifest file, in the Package tab change the Package Name value. Notice how changing this will also change the Package Family Name as well.
Lastly, change the Display Name from the Application tab so you can differentiate the apps when ruuning.

SQL CLR no longer deploys to SQL 2008

I have a SQL CLR project that deploys stored procs to a server. For 2 years I've always been able to just right click the project and deploy. Yesterday I have started to get errors when I try to do that. I was able to deploy a new version last week but not this week.
------ Build started: Project: '', Configuration: Debug Any CPU ------
'' -> E:\Development\Code\SqlDeployables\''\bin\Debug\''.dll
------ Deploy started: Project: '', Configuration: Debug Any CPU ------
Error: Class not registered.
Looking for object with CLSID: {475E0C1F-1E61-4197-9324-10A148C512F8}.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
I've been searching around and can't find anything on the error. There has been no updates on the sql server since I could last deploy. I have uninstalled my VS2010 updates as well as .net updates on my machine and that has not done anything. The only updates I have not uninstalled were office ones, which I would think are not the problem.
Any ideas? I've tried resetting permissions on the sql machine. Removed Stored procs manually and redeploy. I've gone back to a previous version of the project and tried to deploy. Restarted SQL Server services on machine.
Visual Studio 2010
SQL Server 2008
Thanks
Somehow your visual studio install has gotten messed up. That CLSID points to the class Microsoft.VisualStudio.Data.Schema.Package.Sql.Internal.ManagedBuildLoggerComClass in the com object C:\Windows\system32\mscoree.dll.
I would recommend trying to do a repair install on visual studio and see if that fixes your issue.
I had the same problem, and I couldn't figure out how to solve it. I think it might have something to do w/ a side-by-side install of VS2012, but I am not sure.
As a workaround I wrote my own T-SQL deploy script. The project builds all right, and it outputs dlls all right. All that is missing is the database deploy (ie, the commands that VS runs against the database to actually deploy your types and methods to the server). In the project's bin folder you may find the .sql file that VS generates; you can use this as a template. The deploy script will end up looking something like this:
USE SomeDatabase
GO
IF OBJECT_ID('dbo.[SomeFunction]') IS NOT NULL DROP FUNCTION dbo.[SomeFunction]
IF EXISTS (SELECT * FROM sys.assemblies WHERE NAME = 'SomeAssembly') DROP ASSEMBLY [SomeAssembly]
GO
CREATE ASSEMBLY [SomeAssembly] AUTHORIZATION dbo
FROM '\path\to\your\dll'
WITH PERMISSION_SET = SAFE
GO
CREATE FUNCTION [dbo].[SomeFunction] ....
EXTERNAL NAME [SomeAssembly].[SomeAssembly.UserDefinedFunctions].[SomeMethod]
GO
Then deploy your stuff manually via SSMS.

Categories