My solution uses the latest version of .net which is 4.8. However, I see the following error message that complaints about a version 4.0 in Azure Pipelines. Can someone let me know how I could resolve this please ?
The error message indicates I need to install 4.0 but I don't think that's the solution. I also opened up the file Microsoft.Common.CurrentVersion.targets and line 1221 has the following. However, I know it is not advisable to edit this file.
<!-- By default if there is no root path set then the task will assume it is Program Files\Reference Assemblies\Microsoft\Framework-->
<GetReferenceAssemblyPaths
Condition="'$(TargetFrameworkMoniker)' != '' and ('$(_TargetFrameworkDirectories)' == '' or '$(_FullFrameworkReferenceAssemblyPaths)' == '')"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
RootPath="$(TargetFrameworkRootPath)"
TargetFrameworkFallbackSearchPaths="$(TargetFrameworkFallbackSearchPaths)"
BypassFrameworkInstallChecks="$(BypassFrameworkInstallChecks)"
>
<Output TaskParameter="ReferenceAssemblyPaths" PropertyName="_TargetFrameworkDirectories"/>
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
<Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName" Condition="'$(TargetFrameworkMonikerDisplayName)' == ''"/>
</GetReferenceAssemblyPaths>
The error message:
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1221,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v4.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Note: There are many similar post in SO that suggest to install VS2019. However, I am getting this message while running the application on Azure Pipelines.
Update
From your description, you are using the Microsoft host agent and the pipeline pop out issue 'cannot found NETFramework,Version=v4.0'.
Your environment looks like this:
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#net-framework
or
https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#net-framework
You can see that the Microsoft host agent does not have the environment you mentioned.
Although you can install what you need at the beginning of the pipeline startup, I do not recommend this practice. Because when you choose microsoft host agent, every time you start the pipeline, you will be assigned a brand new azure VM machine, which means you need to install the relevant environment every time.
The recommended approach is to use a self-host agent. Please create a self-host agent based on your local machine (or another machine with the relevant environment), the steps are as follows:
https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
Provided above are the installation steps of windows self host agent, the steps should be very simple, if you encounter any problems please let me know.
And after that, you can run your pipeline based on that self host agent like this:
pool:
name: <your agent pool name>
If you are using classic pipeline, just click and select:
(If you run successfully on local, then the agent based on local machine should also be no problem.)
And if this is still unable to solve your issue, could you please remove the in-private information and share the YAML file or JSON file, and let me know at which step you encountered this issue?
I have added <MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule> to .pubxml file in order to encrypt web config file. However, when publishing, i got the following error. I do not know whether there is extra setting needed in the web.config file other than inserting <MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule> in .pubxml
Error:
Web deployment task failed.(Fail to encrypt destination web.config. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG.)
Note: #ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG does not appears anywhere on the given link.
How could i resolve this error? (note: i do not wish to pre-encrypt the web.config file locally before publishing it)
The problem seem to be that MSDeployEnableWebConfigEncryptRule doesn't work with MVC project that have multiple web.config files. Typically MVC project has Views/Web.Config file. This seems like a bug with MSDeploy.
My Workaround is to have a post deployment powershell script to perform same command on the destination server. See http://www.iis.net/learn/publish/using-web-deploy/web-deploy-powershell-cmdlets
Powershell Script Sample:
Add-PSSnapin WDeploySnapin3.0
$cmd = '%windir%\Microsoft.NET\Framework\v4.0.30319\ASPNET_REGIIS.exe -{0} {1} "{2}"' -f 'pef', 'connectionStrings', $destinationFolder
New-WDPublishSettings -UserId $UserName -Password $Password -ComputerName $destination -AllowUntrusted -FileName server.publishsettings -AgentType MSDepSvc -Site $Website
Invoke-WDCommand -Command $cmd -DestinationPublishSettings server -Verbose
I was getting this same message too.
I looked in the Web Deployment logs in the Event Viewer > Microsoft Web Deploy. The Exception it was giving me was:
ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG
Microsoft.Web.Deployment.DeploymentDetailedClientServerException: Failed to encrypt destination web.config: .... Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG. ---> System.Security.Cryptography.CryptographicException: Object already exists.
Googling this led me to this answer from "Just TFS": Release Management Agent not connecting
Which said "The Deployer user (\) does not have access to the crypto store. On the server where the deployment agent is installed, navigate to this folder %ALLUSERSPROFILE%\Application Data\Microsoft\Crypto\RSA\MachineKeys and give read/write access to \. – Just TFS Sep 3 '14 at 12:08"
So I attempted to give my MS Deployer user account read/write to that MachineKeys folder but it denied me access to do so. I ended up adding the deployer user account as a local Administrator and that did the trick.
Was able to deploy with it encrypting the web.config file successfully to the server.
I want to host a 32bit application in IIS 7 on 64 bit Windows 2008. When I visit the site with the default modules enabled I get this error -
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Module: DynamicCompressionModule
Notification: SendResponse
Handler: StaticFile
Error Code: 0x8007007e
If I remove the StaticCompressionModule and DynamicCompressionModule the site works.
Can I get it working without having to disable these modules?
Microsoft KB says
This problem occurs because the ApplicationHost.config file or the Web.config file references a module or a DLL that is invalid or that does not exist.
Try enabling 32bit application in Application Pool configuration
EDIT:
Found the folowing
For above specific error (mentioned in this example), DynamicCompressionModule module is causing the trouble. This is because of the XPress compression scheme module (suscomp.dll) which gets installed with WSUS. Since Compression schemes are defined globally and try to load in every application Pool, it will result in this error when 64bit version of suscomp.dll attempts to load in an application pool which is running in 32bit mode.
This module entry looks like:
Hence to get rid of this problem:
Ø Remove/Disable the XPress compression scheme from the configuration using the command below:
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-[name='xpress']
OR
Ø Use a 32bit version of suscomp.dll
In the end I couldn't get it to work without disabling these two modules. It's worth noting that if you're using Visual Studio to deploy your application to an IIS server, your applications config is going to overwrite what is on the server and thus, reenable the two modules. You need to disable the modules in your config file.
I'm trying to deploy a ClickOnce application, but installation fails on the client. Here's the error log:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.1
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
SOURCES
Deployment url : http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application
Server : Microsoft-IIS/7.5
X-Powered-By : ASP.NET
Deployment Provider url : http://MyProduct.com/Download/Workstation/MyProduct%20Front%20Desk.application
Server : Microsoft-IIS/7.5
X-Powered-By : ASP.NET
Application url : http://MyProduct.com/Download/Workstation/Application%20Files/MyProduct%20Front%20Desk_1_0_0_7/MyProduct%20Front%20Desk.exe.manifest
Server : Microsoft-IIS/7.5
X-Powered-By : ASP.NET
IDENTITIES
Deployment Identity : MyProduct Front Desk.application, Version=1.0.0.7, Culture=neutral, PublicKeyToken=df343a0868ab2d74, processorArchitecture=msil
Application Identity : MyProduct Front Desk.exe, Version=1.0.0.7, Culture=neutral, PublicKeyToken=df343a0868ab2d74, processorArchitecture=msil, type=win32
APPLICATION SUMMARY
* Installable application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application resulted in exception. Following failure messages were detected:
+ Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [03/17/11 11:51:04] : Activation of http://MyProduct.com/download/workstation/MyProduct%20Front%20Desk.application has started.
* [03/17/11 11:51:04] : Processing of deployment manifest has successfully completed.
* [03/17/11 11:51:04] : Installation of the application has started.
* [03/17/11 11:51:05] : Processing of application manifest has successfully completed.
* [03/17/11 11:51:06] : Found compatible runtime version 4.0.30319.
* [03/17/11 11:51:06] : Request of trust and detection of platform is complete.
ERROR DETAILS
Following errors were detected during this operation.
* [03/17/11 11:51:30] System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
- Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
The main exe I need to deploy is MyProductFrontDesk.exe, which has a dependency on MyProductSiteServer.exe - and that appears to be where the error is being thrown: "Reference in the manifest does not match the identity of the downloaded assembly MyProductSiteServer.exe."
Which manifest needs to be corrected? And how?
There was an issue with Visual Studio 2008 which is solved by not embedding the default manifest - one of the comments on that article suggests the problem still exists in Visual Studio 2010.
In project properties -> Application tab -> Resources -> checkbox Icon and manifest, the setting "Embed manifest with default settings" caused the problem. Setting it to "Create application without a manifest" fixes the problem.
I had the same issue when I added a reference to another project.
The way to solve this was enabling ClickOnce Security Settings in all referenced projects as Ian explained here (emphasis mine):
For me, the way this was resolved was to ensure that all the Projects under the Solution which exposed the "Security Tab" in their "Project Properties" had the Option "Enable ClickOnce Security Settings" Ticked with the Option "This is a full trust application" Selected. This has to do with creating the Manifest correctly and the application will not install if these options are not set on all the Projects within the Solution that require it.
I believe this is the proper way to fix it when making a reference to another project under the same solution.
The linked forum post has expired by now, but it's available on archive here.
I was encountering the same problem, but my solution was very different.
My ClickOnce application was referencing another EXE file project in my solution, so when the client downloaded it, and there was another EXE file, that one didn't have a manifest.
Removing the dependency on another executable solved my problem.
I confirmed that the issue also exists in Visual Studio 2010. Selecting "Create application without a manifest" in Project Properties - Application - Resources solved the problem.
I have experienced the same error when deploying with the project set to Debug. When it was changed back to Release there was no error.
This can also happen if you have two different versions of a NuGet package referenced in different DLL files in your project. In my case I was using a framework called Catel, and I had a newer version referenced in one DLL file than another (oversight), but this caused ClickOnce to spit out this error. Referencing the same version resolved the problem.
I had the same problem, but my solution was to change the 'Platform target' to 'x86' (Project Properties -> Build Tab). It was set to Any CPU. As soon as I changed the setting and republished, the ClickOnce installer was able to complete.
I had exactly the same issue. I could not remove the dependency as it was needed by the main project. The second project was a console project.
I changed to Class Library, and then it all worked.
I had the same issue, and I tried all of previous suggested solutions here, and all of them didn't work.
I fixed it by changing the update location. From project properties -> Publish -> Updates. Change the update location to your published folder.
Another workaround, in case the dependency exe with the bad app manifest cannot be changed (say coming from a NuGet package). The binary can be included as content with a dummy extension so ClickOnce does not try validating the manifest and then renamed during app startup.
csproj:
<Content Include="..\packages\<package>\lib\<app>.exe">
<Link><app>.exe.bin</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<ItemGroup>
<PublishFile Include="<app>">
<Visible>False</Visible>
<Group>
</Group>
<TargetPath>
</TargetPath>
<PublishState>Exclude</PublishState>
<IncludeHash>True</IncludeHash>
<FileType>Assembly</FileType>
</PublishFile>
</ItemGroup>
App.xaml.cs:
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
var appDir = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
if (!File.Exists($"{appDir}\\<app>.exe"))
{
File.Copy($"{appDir}\\<app>.exe.bin", $"{appDir}\\<app>.exe");
}
}
}
If you have one main program that references another then you have to do the "Create application without a manifest" trick on the main program's Program:
Project --> Properties --> Application Tab -->Resources --> Manifest -->drop down "Create application without a manifest"
and then switch over to the referenced program's Project Properties and repeat the process.
I had the same issue a couple of minutes ago, and below are the steps that I used to solve it.
Key
a = Main project (the project you want to publish, e.g. myProduct)
b = Reference project (e.g. MyProductSiteServer)
Checklist
Navigate to properties -> Application -> Resources -> check icons and manifest (for both a and b)
Navigate to properties -> Build : make sure that a and b are on the same target platform
Navigate to properties -> Security and make sure that a and b have these settings checked: "Enable ClickOnce security settings" and "This is a full trust application"
Navigate to properties -> Publish : I recommend you change the path of the publishing folder
ALSO SOLVED FOR ClickOnce .exe calling .exe calling .exe.
I had this problem also, using VB.NET in Visual Studio 2010.
I have a ClickOnce Windows Forms application that references a second Windows Forms application that in turn references a third Windows Forms application. (These second and third applications are EXE files rather than DLL file for simplicity, as they are equally likely to be run stand-alone or called with properties passed to them.)
I had to comment out BOTH the second and third applications' manifest contents per:
Walkthrough: Manually Deploying a ClickOnce Application
It works perfectly.
I use mage.exe to generate my manifest. Adding this to my .csproj fixed the issue. You may also try the -nowin32manifest compiler flag; I've not tested it. I don't see stuartd's "Create application without a manifest" in Visual Studio 2017; I think this is what it does though.
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
I also have this in my .csproj:
<GenerateManifests>false</GenerateManifests>
I had this exact same issue with my VS 2019 application.
I have tried creating the application without a manifest however that did not work.
What did work however was the following:
Go to Build-->Publish-->Application
Click on the "Assembly Information" button
Tick the "Make assembly COM-Visible" option
Hopefully, this helps!
it seems like the issue is caused by the setup.exe in vs 2019. it seems that the exe won't update its version when doing a new deployment. the workaround for me is to
delete everything in the deployment folder.
uncheck "Create setup program to install prerequisite components" in Properties => Publish => Prerequisite.
do a deployment.
come back and re-enable "Create setup program to install prerequisite components".
guess this process will force vs 2019 to update setup.exe to the correct version.
also Project --> Properties --> Application Tab -->Resources --> Manifest -->drop down "Create application without a manifest" will work but the app won't update if there is a newer version so I have to fall back to the workaround above.
I faced the same, So whenever you update an assembly , In my case I was downgrading from CR For .Net framework 4.0 to Framework 2.0 , I replaced all referenced assemblies with the old one , The project runs fine but in order to publish
YOU MUST CLEAN WHOLE SOLUTION
then rebuild all , then publish it will solve the problem.
Thanks
I am using Visual Studio 2012 on Windows 7 and need to publish a solution consisting of two projects.
As Eduardo pointed out, marking both projects as ClickOnce, and enabling Full Trust Application resolves the problem.
I had a bit of a different problem that I was able to resolve and so I wanted to post. My issues was I was running 3 branches out of TFS. I had upgraded Telerik controls in one of my branches but not the others. Once I upgraded the Telerik controls in all 3 branches and re-published it worked and this error went away.
I was running VS2015 at the time.
It is interesting. I just redeploy the application and problem solved. Maybe a file corruption because of network.
In my version of Visual Studio 2017, version 15.6.6 (but it may been have there earlier) I found that the Application Files was not in the Right Click Exe Project and Publish, but under the Project Properties Publish Tab where you can set which of the Application Files that you want to to be put in the install.
So take out the ones that are a problem. If something is already installed on a computer where this app will be installed, there is no reason to try to reinstall it anyways, except if you need the reference for it to run. If it were to install what was already on the pc, but to a different folder it might not work. It is best to use the other applications or dll assemblies to the same location as they were previously installed.
In my case 2 exe projects in a solution had .NET target set to 4.8 and 4.6.1. After I set both to 4.8, the error stopped.
I am Using Visual Studio 2022 and the error came up.
Solved it by excluding Log4Net file in the Publish > Application Files.
and the error Stopped
I have an ASP.NET 3.5 web application which works perfectly fine on my local machine and when I deploy it on my Windows 2008 server. I am getting the following javascript error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0
URI: http://localhost/ScriptResource.axd?d=e1Gld4LGHLsC4rWqevEI8zAMJKoVcCEVHBjdJIxcQLO9of6t7nNopbI1YyxJTv1QbaxN_lTSoz5Ly-VjBRHp08Mf3xxg5V9i5Z0AiXIkZRY1&t=6af1de90
I have a utility which can decrypt the URI and tell exactly what file is missing and it tunrns out that the file is ZSystem.Web.Extensions,3.5.0.0,,31bf3856ad364e35|MicrosoftAjax.debug.js|. Why am I not able to load this js file? Any help?
Possible options:
You've not installed .NET Framework SP1 on your server, so it can't find the 3.5 assemblies to generate the MsAjax file.
You've deployed your web.config file with <compilation debug="true"> while IIS has been configured to compile it in release mode.
I have run into a similar problem before when the development and production machines are set for two different time zones. When ASP.NET AJAX tries to load a script resource from an assembly, the last modified date/time of the assembly is validated. If the local time of the production server is "earlier" than the last modified date/time of the assembly, then an ArgumentOutOfRange exception is generated by ASP.NET AJAX when processing the request.
Really difficult to debug since the problem eventually resolves itself.
I suppose this might be possible with a System assembly if Copy-Local is set to true.
I was using some third party web services and the problem was with the following xml tag in the web.config:
<extendedProtectionPolicy policyEnforcement="Never" />
Once I removed this tag the error went away