Compiling MSI (Windows Installer) from asp.net application - c#

We have the following problem, which is proving non trivial to solve.
We are building an MSI installer from within our Asp.Net WebForms application.
Firstly we build an exe.config file with user specific vars and then a vdproj file which is passed to devenv to build the actual installer.
This process runs fine when using the debugger but fails when running under IIS. So instinctively we thought this must be a permissions issue but even setting the application as my own account which is running visual studio it still fails. Could there be another permission that is being missed, even though the compiler is defiantly being called?
Inspecting the visual studio log provides very little information and having had a dig around using the rather non descriptive error has proved to be fruitless.
------ Starting pre-build validation for project 'xxxxxxxx.xxxxxxxx.Installer' ------
------ Pre-build validation for project 'xxxxxxxx.xxxxxxxx.Installer' completed ------
------ Build started: Project: xxxxxxxxxx.xxxxxxxx.Installer, Configuration: Release ----- -
Building file 'D:\xxxxxxx.xxxxxxx.Installer\CustomerInstallers\9999- 12349237\xxxxxxx.xxxxxxx.Installer.msi'...
ERROR: Unrecoverable build error
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
So more information, the application has been working fine on the server up until a couple of weeks ago but there is nothing really suggesting what could have changed as the application was working for weeks after the last set of updates were installed.
The application is running under .NET 3.5 the application it is building is .NET 2.0
The compiler/visual studio version 2008 (9.0.21022.8 RTM)
Just for reference I have tried the solutions suggested here and here but still no luck.

Are you running this in an integrated or classic mode application pool? I had a similar issue, albeit with different circumstances. Changing the pool fixed the problem.
I mention this because we chased the same dogs you have, as far as configuration and permissions go.

Related

Getting a ERROR_COULD_NOT_CONNECT_TO_REMOTESVC error when trying to publish a website from VS 2022

I've been trying to publish a new ASP.NET MVC Core app I wrote, using .NET 6, to a Windows 2019 Server. I followed the instructions on this page https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-6.0&tabs=visual-studio. I believe I've done everything on required on this page to deploy a framework-dependent application to the server. .NET 6 has already been installed. In fact, the .NET Core Hosting bundle has been applied to the server.
I've created the website in IIS on the server.
I've made sure I can ping the target server from my development machine.
When I got the ERROR_COULD_NOT_CONNECT_TO_REMOTESVC I looked up what that error was, which led me to here https://learn.microsoft.com/en-us/iis/publish/troubleshooting-web-deploy/web-deploy-error-codes#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
The Web Management Service wasn't installed, so I had that installed. It is running and set to automatically start.
I've had my IT group double check that port 8172 on the target server is opened so that deploying from VS 2022 using Web Deploy will work. That's fine - it's open and ready to receive deployments.
Here's part of the error:
Build started...
1>------ Build started: Project: Common, Configuration: Release Any CPU ------
1>Common -> D:\Repos\PW\PharmacyWarehouseV2\Common\bin\Release\net6.0\Common.dll
2>------ Build started: Project: PharmacyWarehouseV2, Configuration: Release Any CPU ------
2>D:\Repos\PW\PharmacyWarehouseV2\PharmacyWarehouseV2\Models\PharmacyDBContext.cs(82,10,82,379): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.'
2>D:\Repos\PW\PharmacyWarehouseV2\PharmacyWarehouseV2\Controllers\SiteToSiteController.cs(44,30,44,43): warning CS8600: Converting null literal or possible null value to non-nullable type.
2>PharmacyWarehouseV2 -> D:\Repos\PW\PharmacyWarehouseV2\PharmacyWarehouseV2\bin\Release\net6.0\PharmacyWarehouseV2.dll
2>Done building project "PharmacyWarehouseV2.csproj".
3>------ Publish started: Project: PharmacyWarehouseV2, Configuration: Release Any CPU ------
PharmacyWarehouseV2 -> D:\Repos\PW\PharmacyWarehouseV2\PharmacyWarehouseV2\bin\Release\net6.0\PharmacyWarehouseV2.dll
PharmacyWarehouseV2 -> D:\Repos\PW\PharmacyWarehouseV2\PharmacyWarehouseV2\obj\Release\net6.0\PubTmp\Out
C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): Error : Web deployment task failed. (Could not connect to the remote computer ("OURSERVER") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)
I've done everything I could do, but I still get that ERROR_COULD_NOT_CONNECT_TO_REMOTESVC whenever I try to deploy to the target server. What am I missing? There must be something more, other than what I've found in the instructions.

aspnet core build slow only when publishing

I have an asp.net core web app. If I click build -> Rebuild, it finishes in just under 15 seconds.
However, if I publish it (via web deploy to azure, FTP to azure, or even just a file system publish to a local folder), it takes a very long time. Over a half hour before I give up and cancel it.
What is different about publishing that could cause this? How can I diagnose this to make it go faster?
I'm not sure if it's relevant, but it spends a long time outputting messages like this:
Added Item(s):
ResolvedFileToPublish=
C:\filepath\bg6.jpg
CopyToPublishDirectory=PreserveNewest
RelativePath=wwwroot\images\bg6.jpg
TargetPath=wwwroot\images\bg6.jpg
Try the following two ways
1.Try disabling windows defender on the machines where publish is slow to see if it fixes the issue.You could have some exclusions to the real-time protection.
2.Make the following settings in your project:
Tools-> Options-> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity

Unable to run ASP.NET projects in 64 bit mode on Windows 10 install with VS 2015

We have recently (yesterday) upgraded to Windows 10 and Visual Studio 2015.
Our ASP.NET project will run absolutely fine if we compile to "Any CPU".
We've now tested it on 2 different machines, compiling to x64 produces the error
Exception Details: System.BadImageFormatException: Could not load file or assembly 'OurDLL' or one of its dependencies. An attempt was made to load a program with an incorrect format.
I have been searching for quite a while and most of the troubleshooting I find is for the reverse problem. That is, someone is trying to run a 32 bit ASP app on a 64 bit machine and receiving this error.
I've done everything like deleting all the obj, bin folders etc.
I've also deleted all the temporary .NET files on the computer and also ran aspnet_regiis.exe from the Framework64 directory.
Has anyone experienced this?
Edit: Confirmed with a 3rd person/3rd machine that ASP.NET project do not work in Windows 10 with VS2015 while compiling to x64. It's starting to look like a VS2015 bug.
You have to enable 64x for your projects
Tools -> Options... -> Projects and Solutions -> Web Projects -> Use the 64 bit version of IIS Express for web sites and projects -> Ok
This will enable 64 bit
We had checked this a few times, so evidently it got reverted back to default at some point, and VS still doesn't give a warning or an option to change this option during compiling.
Anyway:
Tools > Options > Projects and Solutions > Web Projects > 'Use the 64 bit
version of IIS Express for websites and projects'
Though we had checked this, I decided to check again.
So in case you are upgrading to VS2015/Windows 10, and using an ASP.NET project, you may want to check this setting a few times especially if you do any .NET updates/Web Tools/VS repairs.

Microsoft Universal Ad Client SDK ad Mediator in XAML UWP apps

On my primary development machine I created an app that can be deployed but lacked advertising. That machine broke and was sent in for repair, thankfully after I committed the working application to source control. I brought up a spare machine, checked out my project making many improvements including successfully displaying adds in the windows 10 UWP application. After repairs were completed on my primary development machine I updated templates, and SDKs that had changed during the repair, ?I believe I got them all?. I checked out the project and after a successful build attempted to deploy and debug.
2>------ Deploy started: Project: Decisive.Uwp.T10, Configuration: Debug x86 ------
2>Updating the layout...
2>Copying files: Total 1 mb to layout...
2>Checking whether required frameworks are installed...
2>Framework: Microsoft.Advertising.Xaml/x86, app package version 10.0.1510.0 is not currently installed.
2>Installing missing frameworks...
2>Error : DEP0800 : The required framework "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0\.\AppX\x86\Microsoft.Advertising.Xaml.x86.10.0.appx" failed to install.
2>error 0x80070005: Opening the package from location Microsoft.Advertising.Xaml.x86.10.0.appx failed.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
I removed the Microsoft.Advertising.Xaml, Version=10.0 leaving the Microsoft.AdMediator.Universal, Version=1.0 The app will now deploy and run but doesn't appear to display adds. I noticed the following warning;
(I don't know how to format the following with wrap so it doesn't need to be scrolled many page widths. I've left it as a paragraph.)
The SDK "Microsoft.AdMediator.Universal, Version=1.0" depends on the following SDK(s) "Microsoft.Advertising.Xaml, Version=10.0", which have not been added to the project or were not found. Please ensure that you add these dependencies to your project or you may experience runtime issues. You can add dependencies to your project through the Reference Manager.
The versions of these two libraries match between the two machines used to created this app.
I'm at a loss attempting to resolve this error Error : DEP0800 : The required framework "C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs\Microsoft.Advertising.Xaml\10.0.\AppX\x86\Microsoft.Advertising.Xaml.x86.10.0.appx" failed to install.
Additional Information 10/21/2015 2008 MST
FWIW With both references intact, in a state where it won't deploy to my windows 10 notebook locally or in the emulator, I deployed to a windows phone mobile emulator. No errors, app runs. Doesn't appear to be displaying ads though.
On the spare machine where the app will deploy to windows 10 locally and display ads, ads are displayed in both the win10 emulator and the mobile emulator.
Additional Information 10/22/2015 0930 MST
The comments on this post regarding WinTools 1.1, TypeScript 1.6 RTM, and Tools for Apache Cordova Updates may shed some light on the problem. They detail a problem that some developers have experienced installing the win tools 1.1 update that apparently the AdMediator relies on.
I had some great hindsight and you can see what assumptions made out of me.
I got in touch with a PM at Microsoft who stated;
Yes, we are aware of the issue that you are talking about. But that
issue might be a red herring in this context – it is all about just
false notifications showing up when you do the upgrade. That should
not have really caused the issue with the AdControl (if you truly had
the issue with a bogus install of the tools, you could not even create
or build a UWP app of any kind).
Eventually I tried running Visual Studio as Administrator. I was able to deploy the app. Afterwards I exited Visual Studio then restarted with normal privileges. I am now able to deploy the app without running Visual Studio as Administrator.

Windows App Certification Kit - error

I am developing a Windows 8 application. I tested the app with Windows Certification Kit, and it was throwing the following error:
Debug configuration test
FAILED
Debug configuration
• Error Found: The debug configuration test detected the following errors:◦The binary myappname.exe is built in debug mode.
• Impact if not fixed: Windows Store doesn’t allow a debug version of an app.
• How to fix: Please make sure the app isn’t linking to any debug versions of a framework, and it is built with release configuration. If this is a managed app please make sure you have installed the correct version of .NET framework.
Any suggestions on what this means and how to solve this problem?
To fix this you need to rebuild your application in release mode then re-run the certification test, the test will never pass if you build Debug.

Categories