I have a Windows Azure project consisting of
ASP.NET project (using NancyFX) deployed as Azure Website
Business Logic class library
Unit test class library
2 Console apps
I want those 2 console app to be deployed as Azure WebJobs with the Azure Website. So I right clikec on the ASP.NET project and chose Add | Existing project as Azure WebJob and added both console apps with the right schedule.
Everything seems fine, the 2 console apps now contain a JSON with schedule and the ASP.NET project contains a JSON with WebJobs definition. All the project build just fine.
The problem is, when I try to deploy the ASP.NET project to Azure, I get
The target “ResolveWebJobFiles” does not exist in the project
I found this article when the author solved this problem by adding
<Import Project="..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.targets" Condition="Exists('..\packages\Microsoft.Web.WebJobs.Publish.1.0.2\tools\webjobs.targets')" />
to his csproj file, but my csproj file for the ASP.NET project already contains this import.
Any ideas what the problem is?
even i faced this issue. I reinstalled the below package in my webjob to solve it
package id="Microsoft.Web.WebJobs.Publish" version="1.0.2"
Check to see if you have this file in your webjob project Properties folder:
webjob-publish-settings.json
If not, create it with this content, changing only the webJobName (for now)
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "MyWebJobName",
"startTime": "2014-12-09T00:00:00-08:00",
"jobRecurrenceFrequency": "Hour",
"interval": 1,
"runMode": "Scheduled",
"stopping_wait_time": 3600
}
One primary reason could be missing "webjob-publish-settings.json" file in Properties.
Please double check this file exists and included in your project.
in my case it was this file, which had 1 invalid webjob associated with it, removed it and it started working
webjobs-list.json
I also ran into this. After updating all packages in my solution I started to get this. The <import /> was there but it was poiting to a different version. So check that too.
Also worth checking is the .net version of the WebJob project vs your Web app!
As stated in the documentation
A WebJobs-enabled project has the following items added to it:
- The Microsoft.Web.WebJobs.Publish NuGet package.
- A webjob-publish-settings.json file that contains deployment and scheduler settings.
it clearly says the project that needs to have a reference to Microsoft.Web.WebJobs.Publish Nuget package is the Webjob-enabled project application, not the web application. The web application only needs webjobs-list.json file.
The webjob console application also may have a webjob-publish-settings.json file
but only in case of non continuous jobs
I got this error recently and found the cause to be that [WebProject]/Properties/webjobs-list.json contained a reference to an old webjob that had been deleted from the solution. Deleting the reference from the json fixed the problem.
In Kudu (under "Advanced Tools" on your web app management page, under "Development Tools"), under "Debug console", select "Powershell", then navigate to the "site" folder, then the "repository" folder.
Enter the command "dotnet restore" at the command line, then redeploy.
Edit: Still works as of 26/01/2022.
Related
Certificate configured as per the guide-line. We are able to generate build without razor class library. When we try to generate build with razor class getting below error.
dotnet\sdk\6.0.400-preview.22301.10\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResoluti
on.targets(267,5): error NETSDK1005: Assets file '\Razo
rClassLibrary\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that
you have included 'net6.0-android' in the TargetFrameworks for your project. [C:/RazorClassLibrary\RazorClassLibrary.csproj]
Tried with below options
Removed obj folder
Restore Nuget Package
Visual Studio update
MSBuild update
Added <RuntimeIdentifier>android-arm64</RuntimeIdentifier>
Spending more than two days, Really appreciate any guide to resolve this issue.
I suggest you try this
In Library project .csproj replace TargetFramework by plural -> <TargetFrameworks>net6.0;net6.0-android</TargetFrameworks>
In App project .csproj, I set android to API21, in my case with API31 didn't work.
In App project, right click, properties, Go to Android / Options / Package Sign, and complete complete info from keystore
I just started learning C# a couple hours ago, but have since run into this error.
Ctrl + Shift + P
.NET:Generate Assets for Build and Debug
But when I click it, an error pops up bottom right of the window:
Could not locate .NET Core project. Assets were not generated.
Restarting VS Code solved the problem in my case.
This same thing started happening to me on my mac on vscode. For me, it was because I didn't add my dotnet project to my solution file after I created the solution file and project.
This is essentially how I created my project:
Create empty project folder mkdir RecipeApp && cd RecipeApp
Add Solution File to Project (uses the name of containing folder) dotnet new sln
Create Backend .NET API dotnet new webapi -o API
Then this is the part I forgot to do (which actually solved a few other problems I was having, like I couldn't use the CMD + . feature to auto import classes and assets etc, too):
Add the sub project to the solution file dotnet sln add API
After I added the API subproject to the solution file, I could open the main top level project folder in vscode, and everything started working again.
This issue could be because the launch.json, which ideally should have been populated with the necessary details isn't generated in case. This issue seems to be linked to Omnisharp. If you go through the issue, you understand the root cause more clearly. You may need to perform the steps mentioned in this comment to get around the issue. These steps involve re-configuring the C# extension inside of your VS Code instance.
Alternately, ensure that all the folders which the extensions uses have appropriate access.
If the issue is also involving task.json, take a look at this answer
In my way helped to change the folder name to a name without spaces.
What I recommend doing is pressing "Run" then start debugging, which should open up a launch.json. If you open it, it will have about 17 warnings and then you can delete the warnings. Then, you press f5, which will give you an option to open a tasks.json. Do that and configure all of the tasks for running your project and it should work.
for me it helped to open the project with opening project_name.csproj with vs-code instead of loading the folder
In my case I just uninstall the c# extension and reload the vscode, after I install again (The vscode will ask to install some assets and somethings that miss in the project too).
Changing extension path manually helped me
I'm working on a WPF application, using VS 2017 version 15.3.3
I was curious to know what's behind the file type Azure Function:
When I added it there was nothing changed in the solution explorer, I ignored that and continued my work (which has nothing to do with Azure), but when I compiled the project I get this error:
The target "RunResolvePublishAssemblies" does not exist in the project
and this warning:
Error encountered while loading the project. Some project features,
such as full solution analysis for the failed project and projects
that depend on it, have been disabled
I switched the solution explorer to view all files, and I found the azure function class is hidden in the place I added in, I deleted it, but the same problem still exist
Please, help!
For me this problem was happening because we switched Azure functions project back from dot net core to 4.5.1. So i deleted 'bin' and 'obj' folders from each of the projects, and re-build. It started working fine for me once deleting these 2 folders. I was able to clean and build the projects. My unit tests are also passing fine.
This GitHub error log helped me with this error: https://github.com/Azure/azure-functions-vs-build-sdk/issues/92
Following this suggestion resolved my build error:
To work-around this specific issue , you may be able to give an empty target in your csproj
<Target Name="RunResolvePublishAssemblies" /> but I am not sure what else would be broken without using the SDK style projects.
I have an ASP.net MVC 5.2 project on a macOS Sierra (not my choice unfortunately) and I am trying to set the client secrets with the SecretManager. I have tried running
dotnet user-secrets set Authentication:Twitter:ConsumerKey <consumer-key>
but I get that
No executable found matching command "dotnet-user-secrets"
I executed the command in the project root and after googling the problem, apparently I need to run the command in the same folder as the project.json which I cannot find in my project structure. (do I need to create it manually?)
I apologise in advance for these beginner questions but I am just getting on board with the .net framework.
Any tips/ideas would be greatly appreciated!
As far as I know now projects use .csproj files instead of project.json, so you have to use it in the folder containing .csproj file
Judging from your project structure I guess it's "TwitterMania" folder - the one nested inside another "TwitterMania" folder
I am using Microsoft Visual Studio 2015, I built a simple website with a C# contact form.
When I compile and run on localhost it works perfectly fine. However, when I try to publish it (on smarterasp.net) I am getting an error:
[Win32Exception (0x80004005): Access is denied]
[ExternalException (0x80004005): Cannot execute a program. The command being executed was "..\bin\roslyn\csc.exe"
I have contacted smarterasp.net and they said they dont allow .exe files. I tried to delete csc.exe with ftp from the server but when I do that I am getting the error:
Could not find file "..\bin\roslyn\csc.exe".
How can I solve this issue with the csc.exe that is trying to get included in my project so I can get my this website published?
After hours of researching i came up with the solution.
Since the .NET 4.5 version, Roslyn compilation is the default way of compiling. This means if you create any web application either Web Forms or MVC using .NET 4.5 you get this Roslyn csc.exe compilation pre-installed in your project.
Basically what i needed was to compile and deploy my project without Roslyn or any .exe files on it.
So here is the Solution that worked for me. You can deploy without Roslyn with no change in code:
Open NuGet Package Manager window
uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform package and rebuild & republish. (This uninstallation also removes CodeDom configuration from web.config file.)
This will solve your purpose. Basically this will not generate any csc.exe, vbc.exe files inside bin folder.
I hope it works for you too!
I had this issue on Smarter ASP. On the browser file manager in the control panel, navigate to 'Roslyn' folder in bin and set .net permission to read/write. It worked then.
If you actually want to keep the roslyn codegen, you just need to set the permissions on the application's bin folder to allow the ApplicationPool user Read & Execute.
I did this using the explorer Security tab on the folder properties dialog, but you should also be able to do something like:
icacls PATH_TO_SERVICE_BIN /grant "ApplicationPoolUser":(OI)(CI)RX
I found the solution as unchecking "Allow precompiled site to be updatable", on publish window.
Just remove the codedom section from the Web.config, this solves the problem.
Just set rw access for /bin folder in Smarterasp.net File Manager as shown below, restart your app
Just experienced the same issue as the OP when publishing an ASP.net 4.5.2 SPA via web deploy in VS2015.
The solution I found to work was to remove the Nuget package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform".
You could, alternatively, simply remove the system.codedom compiler config section from your Web.config file, which would have the same affect.
Here's how I got it working:
In your control panel, navigate to Security Manager > Allow .EXE Files
Set the value to On (this will let you upload .exe files)
In your Web.config, set full trust (this will let you run them)
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
In your publish settings, enable "Precompile during publishing", but in the
Advanced Precompile Settings (the Configure link next to this option), disable "Allow precompiled site to be updateable".
I had the same error and I solved it by enable the permissions of the hosting directory (read/write/delete).
If you need SmarterAsp.Net to allow the uploading of an .exe file to support the features and functionality of your website, you can. Just go to the control panel and turn on "Allow .Exe Files" See below:
In my case I had to do this because I wanted to host an Asp.Net Core website and that absolutely requires an .exe file :-)
tl;dr: Ensure that csc.exe is not zero bytes in size.
Longer answer
To add yet another cause and solution: In my case, I got this Yellow Screen Of Death in my browser:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code 255.
c:\windows\system32\inetsrv>C:\inetpub\wwwroot\bin\roslyn\csc.exe
/t:library /utf8output /nostdlib+ ...
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.7.2558.0
Upon investigation, I isolated the call to csc.exe by executing it inside a CMD window:
c:\inetpub\wwwroot\bin\roslyn\csc.exe
I got this message box:
followed by this line in the CMD window:
Access is denied.
Upon inspecting the files in Windows File Explorer I found out that csc.exe had a size of zero bytes.
I'm unsure at which stage of my deployment script this happens, but after replacing the 0-byte-sized csc.exe with an actual working one, everything works correctly.
The above solutions did not work for me and are not correct, since roslyn is not optional these days.
What worked was ensuring that the pool account had read & execute permissions on the root folder of the web application. You can find the account to grant this permission to by finding the Pool name your web app uses, then Application Pool -> pool name -> Advanced Settings -> Identity.
My VPS host uses non-standard directories for hosting as follows:
c:\home\web.app.name\wwwroot
The web.app.name folder needed the permission.
Updating the nuget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform to the latest version (at that time) 2.0.1 resolved this issue for me without having to grant permissions to the folder or remove the compiler.
We encountered this due to a 3rd party application. MalwareBytes Anti-Ransomeware was actually the culprit that was blocking access. Resolved this with:
Right-click systray icon for MalwareBytes Anti-Ransomeware (not anti-exploit)
Stop Protection