c# - How to use a resource file in Visual Studio 2015 -


i'm creating integration tests (web class library project) asp5 mvc6 application. want add resource file raw sql test project db preparation.

i wanted use old resources (.resx). it's not available in add new item project's menu.

i found this answer pointing github repo. guess reads file:

using (var stream = fileprovider.getfileinfo("compiler/resources/layout.html").createreadstream())                 using (var streamreader = new streamreader(stream))                 {                     return streamreader.readtoend().replace("~", $"{basepath}/compiler/resources");                 } 

i tried using system.io.file.readalltext("compiler/resources/my.sql") in test helper project in testhelper class.

when used testhelper class in actual test project looking the file in test project directory.

testproject/compiler/resources/my.sql insetad of testhelperproject/compiler/resources/my.sql

i can figure out couple of workarounds. i'd right way. preferably in resx file:

string sql = resources.mysql; 

any suggestions?

edit

project type enter image description here

available items enter image description here

it little more complicated because there's no tooling support doable:

  1. create resx file or copy somewhere else classic c# project
  2. if can use sake build system, can use same target we, asp.net team use: https://github.com/aspnet/universe/blob/dev/build/_k-generate-resx.shade otherwise, need implement similar in own build scripts
  3. place resources either compiler/resources. if place them under other folder include them in project json (like here)
  4. build using sake build using dnx. resource should available strong type object

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -