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
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 have a Visual Studio solution containing various sample console app projects. One of which is MapsterSample where I am trying out Mapster and following the steps described on GitHub https://github.com/MapsterMapper/Mapster/wiki/Mapster.Tool to generate mapping code.
Everything seems fine except for the part where I issue the command:
dotnet msbuild -t:Mapster
This results in the command executing for every project in the solution even if MapsterSample is selected as Default project in Package Manager Console:
SampleSolution\FirstSample\FirstSample.csproj : error MSB4057: The target "Mapster" does not exist in the project.
SampleSolution\SecondSample\SecondSample.csproj : error MSB4057: The target "Mapster" does not exist in the project.
... and so on
Is there a way to just execute the command for the MapsterSample project?
Make sure the project exists within your solution.
Make sure that the name Mapster is spelled correctly.
Make sure your terminal is in the correct directory. (ideally you should be in the directory ABOVE the directory the .csproj for Mapster is in.
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 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.
I have a web project created in Visual Studio 2012 that consists of a project as well as a web application. Both share the same solution. I'm basically just trying to get the DLL that's created in the project to be passed to the bin folder of the web application automatically with each build. I know it can be done because it's like that on other web projects I have, but I don't know why it works on some and not on others. I've been searching the internet hours, but have had zero luck. It seems like a very simple setting change so maybe someone on here knows.
I finally found the simple, one line answer I was looking for. I'll post the answer here to help others...
Go to Properties (for project in question), click on Build Events, enter the following into the Post-Build Event Command Line:
Copy /Y "$(ProjectDir)bin\debug*." "$(SolutionDir)bin*."
In this case, ProjectDir is the root directory of the project and SolutionDir is the root directory of the web application.